Alright, well this code is useless on every day of the year except, you guessed it, APRIL FOOLS DAY! What we are going to create is a code that reopens a page when the user navigates away from it. This will become very annoying and is a great little prank to play on your friends. Here is the code:
<script type=”text/javascript”>
function openIt(){
window.open(”http://www.yoursite.com”);
}
</script>
<body onunload=”openIt()”>
</body>
Well, first off, you can have other code in the body to make this seem like more of a webpage, this code will just generate a blank screen. But anyways, on the first few lines I used javascript to create a function called openIt. When this function is called it opens up the page inside the brackets. You can change “http://www.yoursite.com” to the URL of the site that contains this code. Then the last major piece of code worth explaining is on line 6. This is what I used to call the openIt. The onunload event calls a function, in this case openIt when the website the user is viewing is closed or navigated away from. This includes, but is not limited to using the back button, exiting out of the browser, or typing a new address in the URL bar.
I hope you enjoyed this code, and used it on all of your friends =D
pretty sweet
Sweet nice prank.
Thanks ;D