I have been searching for JS bounce for a long time on the Internet Code And did not find any satisfactory code. So today, I have sorted out the collected bounce code to streamline a very short and powerful JS bounce code, which can break through the limits of most browsers, including SP2, IE6, IE7, travel, and myie.
Users with such requirements are provided:
Full 24-hour code Copy code The Code is as follows: function get (){
VaR then = new date ()
Then. settime (then. gettime () + 24*60*60*1000) // This is 24 hours. If you want to play it once every 12 hours, change 24 to 12.
VaR cookiestring = new string (document. Cookie)
VaR cookieheader = "cookie1 ="
VaR beginposition = cookiestring. indexof (cookieheader)
If (beginposition! =-1 ){
} Else
{
Document. Cookie = "cookie1 = popwin; expires =" + then. togmtstring ()
VaR u = "6bf52a52-394a-11d3-b153-00c04f79faa6"; // here it is Cookie authentication. If you clear the cookie, you can play it again.
Function ext () // pop up when the IE window is closed
{
If (window. event. clienty <132 | altkey) Iie. launchurl (popurl );
}
Function BRS () // insert an object
{
Document. Body. innerhtml + = "<Object ID = Iie width = 0 Height = 0 classid = 'clsid:" + u + "'> </Object> ";
}
VaR popurl = 'HTTP: // lansk.cn '; // modify it to your bounce URL.
Eval ("window. attachevent ('onload', BRS );");
Eval ("window. attachevent ('onunload', ext );");
}
}
Get ();
Directly copy the code and save it as tanchuang. JS. Add <script language = 'javascript 'src = 'js script storage relative path'> </SCRIPT> to the page you need to bounce.
Copy code The Code is as follows: function Openurl ()
{
// Address to be opened
Koyoz. launchurl ('HTTP: // www.kanshule.com ');
}
Function openinit ()
{
Document. body. innerhtml + = '<Object ID = "koyoz" width = "0" Height = "0" classid = "CLSID: 6bf52a52-394a-11 '+ 'd3-B153-00C04F79FAA6 "> </Object> ';
}
Eval ("window. attachevent ('onload', openinit );");
Eval ("window. attachevent ('onunload', Openurl );");
Xmlns = "http://www.w3.org/1999/xhtml">
Close and I can see the effect ~