HackingUniversity - Hacks . Tricks . How-To's

08 September 2013

7 Coolest JavaScript Tricks & Hacks you should check out !

JavaScript has just changed the way people used to interact with their website's, adding more creative stuff and executing just makes readers experience much more fun and enjoyable. Well we have a list of 7 awesome and amazing JavaScript tricks and hacks that you could use to make more out of this awesome language.

  1. Website Editing - Just like the inbuilt chrome and Firefox you have the ability to make changes on any website, using the below JavaScript you have the freeform ability to make changes to any web page. So now if you are on chrome press Ctrl + Shift + J & press Ctrl + Shift + K to open the console menu & paste below code into it & Press Enter. Well I have even posted a nice video tutorial so have a look at that too, maybe that could help you out.

    javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

  2. Dancing Images - So making images dance is a neat trick, we are going to execute using this simple JavaScript code, so this code automatically grabs all the images from the website and get them dancing in round pattern, increasing speeds by time. So now just press Ctrl + Shift + J on chrome and Ctrl + Shift + K on firefox to open the console menu and paste the below code into it. Do have a look at the below video if you find any problem.

    javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);

  3. JavaScript Calculator - Well if you do not love the default calculator app you get with your Windows OS, then you can obviously use the JavaScript calculator app using the console menu in Chrome. Well either you use the JavaScript way or their a direct way to that's implemented right now. So now just paste the below JavaScript code into your Chrome console menu and as soon as you hit enter you will see a popup with your answer. The another easy way is to just try your digits & hit enter to see the answer. Well make sure to change the below digits with yours.

    javascript: alert(34343+3434-222);

  4. spoofed-URL'sFinding Spoofed Websites - Sometimes it could happen that you are redirected to some unknown website that you might don't want to see or it might be harmful for your computer or so, well you can use the below JavaScript code to see if the server names on that site match with two URL's. So now you will popup like on the right when you will use the below javascript code, so now if the two URL's do not match then the site might be spoofed, so this code could prove to be useful at time you need it so copy below javascript code into your console menu of chrome by pressing Ctrl + Shift + J or firefox by pressing Ctrl + Shift + K, that's it.

    javascript:alert("The actual URL is:\t\t" + location.protocol + "//" + location.hostname + "/" + "\nThe address URL is:\t\t" + location.href + "\n" + "\nIf the server names do not match, this may be a spoof.");

  5. Katamari Hack - Delivers that ball demolishing fun, well after executing this javascript you can easily destroy any website and have fun on it. Well I have a separate post on how this one works so check it out [Link]
  6. Asteroids Shooting - This is another awesome fun shooting game, that you can use to destroy any website, well it works well in chrome and firefox, so check this post over here [Link] to see how it actually works.