The JavaScript Prank Website

Benjamin Yee

Back to Top

The Code Vault


How to use this site:

There are three ways to use these pranks:

  1. Copy the code, type   javascript: into the search bar (on the same page), then paste the code directly after.

  2. Copy the code, open the JavaScript console (cntrl + shift + J on Chrome), then paste the code.

  3. Right-click on the bookmarks bar, then click 'Add Page' (Chrome) or 'Add Bookmark' (FireFox). Copy the code into URL/Location box, and give it a name. Activate the code by clicking on the bookmarklet on any website.


Refresh the page to stop the scripts.



Prank List


See these pranks in action at: https://www.youtube.com/watch?v=cpXQ9BQvKls&list=PL31UXAZ-DdoQF91GehSgSoAd4ZGfIy_9Z


The Infinite Loading Website

This prank will disable all links on the page (except ads), and will change the mouse into its waiting state.

The user can click everywhere, but nothing will respond!


(function(){var x = document.body.getElementsByTagName("*"); for (i = 0; i < x.length; i++){x[i].style.cursor = "wait"; x[i].removeAttribute("href");}}());



The Webpage Black Hole

This prank will create a website black hole in the middle of the page, sucking in all elements in a chaotic vortex!

The page elements will still work... if you can click them through the mess!


(function(){var x = document.getElementsByTagName("*"); for (i = 0; i < x.length; i++) {x[i].style.position = "absolute"; x[i].style.top = "50%"; x[i].style.left = "50%"; x[i].style.transition = "5s"; x[i].style.transform = "translate(-50%, -50%)"}}());



The Fading Website

This prank will fade the website to nothing...

The page is still navigable, just invisible. You can use this to your advantage, if you know the website well!


(function(){document.documentElement.style.transition="10s"; document.documentElement.style.opacity="0";}());



The Mirrored Website

This prank will reverse the direction of the website, as if looking in a mirror!

The page is still navigable, just in reverse.


(function(){var x = document.getElementsByTagName("body"); x[0].style.transform = "scaleX(-1)";}());



The Shrinking Webpage

This prank will shrink the website, until it's just 10% of it's original size!

You can modify this prank by changing the value at scale(0.1). Just change the value of 0.1 to anything between 0 and 1. A value of 0 will make the page completely disappear!

Also, the page is still navigable!


(function(){document.documentElement.style.transitionDuration="10s";document.documentElement.style.transformOrigin = "center, top";document.documentElement.style.transitionTimingFunction="ease-in";document.documentElement.style.transform="scale(0.1)";}());



The Spinning Webpage

This prank will spin the website 1000 times in 60 seconds!

You can modifiy this prank by changing the values at transitionDuration="60s" (change the animation length), or at transform="rotate(360000deg)" (change the number of times the page spins, 360deg = 1 turn, 720deg = 2 turns, etc. Don't forget the 'deg' at the end of the value!)


(function(){document.documentElement.style.transitionDuration="60s";document.documentElement.style.transitionTimingFunction="ease-in";document.documentElement.style.transform="rotate(360000deg)";}());



The Text Hax Prank

This prank will replace all words on the page with 'hax'! Includes a complementary message for the victim!

You can modify this prank by changing the values at nodeValue = "hax" (changes the text hack word), or at alert("Page Haxxed!") (changes the message to the victim).


(function(){var walker=document.createTreeWalker(document.documentElement, NodeFilter.SHOW_TEXT, null, false); while (walker.nextNode()){walker.currentNode.nodeValue = "hax";}; alert("Page Haxxed!");}());



The Website Spellchecker

This prank 'checks' the page for spelling errors... Everything is wrong!

The page is still navigable, just with all text on strikethrough.


(function(){var x = document.getElementsByTagName("*"); for (i=0;i



The Short-Sighted Prank

This page will set the font size of all elements on the page to 100px!

You can modify this prank at fontSize = "100px". Just change the 100px to any value! Just don't forget the px at the end.

Note! This prank may be quite slow on weaker devices, and may not work at all on some websites. This prank is inherently slow, so it may take several minutes to see the full effect.


(function(){var x = document.body.getElementsByTagName("*"); for (i = 0; i < x.length; i++) {x[i].style.transition = "10s"}; document.body.style.fontSize = "100px";}());



The Website Blue Screen

This prank will create a blue screen that pushes everything off the screen.

You can modify the animation time of this prank at transition="10s". Just change the value of 10s to any value in seconds. Don't forget the s at the end!


(function(){document.body.style.transition="10s";document.body.style.borderLeft="2000px solid blue";document.body.style.overflowX="hidden";}());



The Page Wrecker

This prank will change anything under the mouse to 'hax'.

Be careful with this prank! It can destroy a page in only three waves of the mouse!


(function(){var x = document.body.getElementsByTagName("*"); for (i = 0; i < x.length; i++) {x[i].setAttribute("onmouseover", "this.innerHTML = 'hax'");}}());



The Disappearing Mouse

This prank will make the mouse disappear, anywhere on the web page.

Also, the page is still navigable!


(function(){var x = document.getElementsByTagName("*"); for (i = 0; i < x.length; i++) {x[i].style.cursor = "none"};}());