Jump to content

Stop Browser window from closing


shonen
 Share

Recommended Posts

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

Link to comment
Share on other sites

<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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...