shonen Posted November 15, 2009 Share Posted November 15, 2009 Hey Guys, I firstly state that when it comes to coding I know sweet stuff all and am a copy and paste monkey. Anyways I am setting up an annoying website for a prank. Its kind of like a rick roll but utilizing caramell dansen and I would like any suggestions and script if anyone cares to help me out that stops the page from being closed. I have seen some sites that loop java script alert messages when someone tries to close the browser tab. I did a search but have been having trouble finding the code. Any help or better suggestions would be much appreciated Quote Link to comment Share on other sites More sharing options...
Netshroud Posted November 15, 2009 Share Posted November 15, 2009 Make a function to handle the browser's OnUnload event. http://www.w3schools.com/jsref/event_onunload.asp Quote Link to comment Share on other sites More sharing options...
shonen Posted November 15, 2009 Author Share Posted November 15, 2009 Make a function to handle the browser's OnUnload event. http://www.w3schools.com/jsref/event_onunload.asp Thanks a bunch for that reference my next question is how do you get the bugger to be on a infinite loop cycle? Quote Link to comment Share on other sites More sharing options...
Netshroud Posted November 15, 2009 Share Posted November 15, 2009 while (1) { // do stuff endlessly } Quote Link to comment Share on other sites More sharing options...
shonen Posted November 15, 2009 Author Share Posted November 15, 2009 I hate to be a noob and ask, but I am anyways. =D Whats the full code with the alert and the while function in one. I had a bit of a fiddle with it in notepad and am kind of blindly trying to work it out. Quote Link to comment Share on other sites More sharing options...
Netshroud Posted November 16, 2009 Share Posted November 16, 2009 <body onunload="Spam()"> Function Spam() { while (1) { alert("spamspsmapsmapmspmapsmpsam"); } } Quote Link to comment Share on other sites More sharing options...
shonen Posted November 16, 2009 Author Share Posted November 16, 2009 I tried using both code in that order and it still is unable to launch on exit in html document. Sorry to break your balls. Quote Link to comment Share on other sites More sharing options...
Netshroud Posted November 16, 2009 Share Posted November 16, 2009 <html> <head> <title>Test Spam</title> <script type="text/javascript" language="javascript"><!-- body.unonload = spam function spam() { while (1) { alert("spamspsmapsmapmspmapsmpsam"); } } //--></script> </head> <body onunload="spam()"> </body> </html> Quote Link to comment Share on other sites More sharing options...
shonen Posted November 16, 2009 Author Share Posted November 16, 2009 Ah awesome, thanks a bundle for that Psychosis. Actually after having a go with that I was wondering how you would add the window.location line to the above so when ever they click ok on the loop they get redirected back to the same site for extra annoyance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.