DotNetBlocks

Things on DotNet, programming, and other useless stuff

JavaScript Browser Hacks

Recently during one of my client side scripting classes, I was trying to show my students some basic examples of JavaScript as an introduction to the language.  My first basic example was to show an alert box using JavaScript via the address bar. The student’s reaction to my browser hack example really caught me off guard in a good way. After programming with a language for close to 10 years you start to lose the "Awe Cool!" effect that new learners of a language experience when writing code. New learns of JavaScript are the reason why I created this post. Please enjoy.

Note: Place JavaScript in to address bar and then press the enter key.

Example 1: JavaScript Alert box displaying My name: John Doe

Javascript:alert('My name: \n John Doe') ;

Example 2: JavaScript alert box displaying name entered by user.

javascript:alert('My name: \n ' + prompt('Enter Name','Name')) ;

Example 3: JavaScript alert box displaying name entered by user, and then displays the length of the name.

javascript:var name= prompt('Enter Name','Name'); alert('My name: \n ' + 
name); alert(name.length);

If you notice, the address bar will execute JavaScript on the current page loaded in the browser using the Document Object Model (DOM). Additionally, the address bar will allow multiple lines to be executed sequentially even though all of the code is contained within one line due to the fact that the JavaScript interpreter uses the “;” to indicate where a line of ends and a new one begins.

After doing a little more research on the topic of JavaScript Browser Hacks I found a few other cool JavaScript hacks which I will list below.

Example 4: Make any webpage editable
Source: http://www.openjason.com/2008/09/02/browser-hack-make-any-web-page-editable/

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

Example 5: CHINESE DRAGON DANCING

Source: http://nzeyi.wordpress.com/2009/06/01/dwrajaxjavascript-hacks-the-secrets-of-javascript-in-the-adress-bar/

javascript:R=0;x1=0.1;y1=0.05;x2=0.25;y2=0.24;x3=1.6;
y3=0.24;x4=300;y4=200;x5=300;y5=200;DI=document.links;
DIL=DI.length;A=function(){for(i=0;i-DIL;i++){DI[i].style.
position='absolute';DI[i].style.left=Math.sin(R*x1+i*x2+x3)*x4+
x5;DI[i].style.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++;};
setInterval('A()',5);void(0);

Example 6: Reveal content stored in password protected fields

javascript:(function(){var s,F,j,f,i; s = “”;
F = document.forms; for(j=0; j

Example 7: Force user to close browser window
Source: http://forums.digitalpoint.com/showthread.php?t=767053

javascript:while(1){alert('Restart your brower to close this box!')}

Learn more about JavaScript Browser Hacks.

  • Quality Function Deployment

    6/23/2011 2:58:06 PM |

    Great ideas!! Awesome post. Not too many people realize how valuable this information is. I found your site through Yahoo.

  • Piper Huckleberry

    6/23/2011 4:17:03 PM |

    good blog man, I really dig your writing style that you are using for your posts and stuff, really hollywood...

  • treatment for insomnia

    6/23/2011 10:35:07 PM |

    A considerate point of view and concepts I most certainly will use on my internet site. You've definitely spent a long time on this. Well done!

  • Gino Schwieterman

    6/24/2011 1:51:12 AM |

    Such a great article you have written. Would it be safe in assuming that youre a premium website writer? ok, I like the hard work you have invested in this article, and this article was very insightful. Hope to read more helpful stuff like this in the future!

  • Charisse Nevils

    6/24/2011 1:53:23 AM |

    Wow a cool website you have posted. Would I be safe in assuming that you may be a premium blog writer? Anyway, I admire the effort you have put in this article, and this website was very full of knowledge. Hope to see more interesting things like this in the future!

  • Raven Wilbon

    6/24/2011 2:54:21 AM |

    Thank you for the incredibly helpful post, we could take advantage of a lot more weblogs like this on the net. Is it possible to elaborate more on the second paragraph please? I'm a tiny bit confused as well as uncertain whether or not I realize your point completely. Thanks a lot.

  • Sherryl Zysk

    6/24/2011 2:55:45 AM |

    Thank you for the incredibly revealing post, we could take advantage of a lot more websites of this nature on the internet. Could you expand more on your second paragraph please? I am a small bit mixed up as well as uncertain whether or not I realize your point completely. Many thanks.

  • Frieda Terada

    6/24/2011 2:55:50 AM |

    I appreciate you for the exceptionally beneficial article, we could benefit from much more personal blogs like this on the net. Would you elaborate a little more about the second paragraph please? I am a small bit confused as well as undecided whether or not I realize your idea entirely. Thank you.

  • Tory Closser

    6/24/2011 2:59:12 AM |

    Many thanks for the especially informative write-up, we could take advantage of a lot more blogs of this nature on the web. Is it possible to expand more about the 2nd paragraph please? I am a tiny bit perplexed as well as unsure whether or not I realize your idea completely. Many thanks.

  • Dorsey Malichi

    6/24/2011 2:59:25 AM |

    Appreciation for your really informative posting, most of us could use a lot more personal blogs similar to this on the web. Is it possible to elaborate a little more about the second paragraph please? I am a small bit baffled and undecided whether or not I realize your point completely. Thank you.

  • Donnie Perey

    6/24/2011 3:02:08 AM |

    Thanks for the incredibly revealing write-up, we all could use much more personal blogs of this nature on the net. Is it possible to expand a little more about the 2nd paragraph please? I'm a little bit puzzled and undecided whether or not I realize your point entirely. Many thanks.

  • Victoria

    6/24/2011 11:23:45 AM |

    Nice post, will definitely recommended this blog to my friends, Thanks for sharing!

    Victoria

  • Charlie

    6/24/2011 1:07:45 PM |

    Thank you for sharing. it is good to encourage people to comment.

  • flirting sms

    6/24/2011 2:41:52 PM |

    hey<P>Saw your blog bookmarked on Digg. Really cool Nice job. Check out my website if you get a chance, just click on name.

  • Select Online

    6/24/2011 5:13:53 PM |

    Superb read, I'm hoping you don't mind if I pass your url link onto my personal friends so that they can go over the great information shared here. Warm regards!

  • tablets android

    6/24/2011 9:15:31 PM |

    I wasn't sure if it could be false labor or what, but I knew there were a few things I needed to do

  • doctor oz Apple cider vinegar for hpv

    6/25/2011 9:22:51 AM |

    Thanks for your posting. My spouse and i have generally observed that most people are needing to lose weight simply because wish to look slim in addition to looking attractive. However, they do not continually realize that there are many benefits for you to losing weight additionally. Doctors assert that over weight people are afflicted with a variety of ailments that can be perfectely attributed to their particular excess weight. The good thing is that people who sadly are overweight in addition to suffering from different diseases are able to reduce the severity of their own illnesses simply by losing weight. It's possible to see a constant but notable improvement with health when even a small amount of fat loss is achieved.

  • best pregnancy books

    6/25/2011 4:09:41 PM |

    Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! However, how could we communicate?

  • Andrew Pelt

    6/26/2011 6:34:05 AM |

    Thank you yet another great post!

  • replica pen

    6/26/2011 6:25:22 PM |

    Leading Manufacturers Of Plastic & Stainless Steel Cable Ties.

  • replica lighters

    6/26/2011 8:18:17 PM |

    Great place to buy pens Up to 50% discount on pens.

  • hypnosis cheltenham

    6/27/2011 10:05:45 AM |

    An interesting discussion is value comment. I feel that you should write more on this topic, it might not be a taboo subject however usually persons are not enough to talk on such topics. To the next. Cheers

  • tani hosting

    6/27/2011 11:09:52 AM |

    Hosting Dedykowany jest to serwer dedykowany (lub jego część) zarządzany przez naszych administratorów. Oferta skierowana jest do klientów potrzebujących większej mocy obliczeniowej niż oferują konta webhostingowe, ale nie posiadających wiedzy i umiejętności umożliwiających administrację serwerem dedykowanym.

  • Jailbreak PS3 3.66

    6/27/2011 6:18:17 PM |

    Nice blog is it a custom theme though? would like to use it

  • Kenya Baudino

    6/27/2011 10:51:35 PM |

    Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but instead of that, this is fantastic blog. An excellent read. I will definitely be back.

  • emuaid

    6/27/2011 11:00:36 PM |

    *The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention.

  • emuaid

    6/27/2011 11:02:44 PM |

    *I’m impressed, I must say. Really rarely do I encounter a blog that’s both educative and entertaining, and let me tell you, you have hit the nail on the head. Your idea is outstanding; the issue is something that not enough people are speaking intelligently about. I am very happy that I stumbled across this in my search for something relating to this.

  • herpes treatment

    6/27/2011 11:05:02 PM |

    *I’d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!

  • Peluang Binis

    6/28/2011 9:53:34 AM |

    Sorry for the huge review, but I'm really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it's the right choice for you.

  • casino en ligne

    6/28/2011 10:00:19 AM |

    I was just looking for this info for a while. After 6 hours of continuous Googleing, at last I got it in your website. I wonder what's the Google's issue that doesn't rank this type of informative websites closer to the top. Generally the top web sites are full of garbage.

  • apprenticeship electrical

    6/28/2011 10:19:33 AM |

    Hey nice work with this post. I know it would have taken a while to write it up.

  • Hipolito M. Wiseman

    6/28/2011 11:03:32 AM |

    As I web site possessor I believe the content material here is rattling wonderful , appreciate it for your hard work. You should keep it up forever! Best of luck.

  • onlinr storage

    6/28/2011 11:40:36 PM |

    I have needed this information for so long. Thanks for sharing it.

  • cables

    6/29/2011 1:21:46 AM |

    This is the right blog for anyone who wants to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!

  • ahoj

    6/29/2011 3:44:08 PM |

    Why didnt I believe about this?  I hear exactly what youre saying and Im so happy that I came across your blog.  You genuinely know what youre talking about, and you created me feel like I ought to learn far more about this.  Thanks for this; Im officially a massive fan of your blog.

  • Frankie Featherstone

    6/30/2011 1:04:25 AM |

    I called ATT customer service tonight and once again is was terrible.  They really should be ashamed at how poor the service is, but they aren't.  Why is it so bad?  Anyone else have this experience?

  • colliers fantaisie

    6/30/2011 2:26:53 AM |

    I'm not sure exactly why but this site is loading extremely slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later and see if the problem still exists.

  • Ria Soderstrom

    6/30/2011 4:24:03 AM |

    Hello i just found this article from Google when i was searching about Mobile App. I want to recommend a link to a mobile site : http://m.derhan.getjar.com . This mobile site providing mobile app to download by user for free. Just open http://m.derhan.getjar.com from your mobile browser and get million app for free into your mobile phone. Thanks.

  • Tyson F. Gautreaux

    6/30/2011 4:27:40 AM |

    There is noticeably a bundle to find out about this. I assume you made certain nice points in features also.

  • colliers fantaisie

    6/30/2011 4:56:04 AM |

    Hmm is anyone else experiencing problems with the images on this blog loading? I'm trying to find out if its a problem on my end or if it's the blog. Any responses would be greatly appreciated.

  • tani hosting

    6/30/2011 7:39:33 AM |

    One day my site fails totally out of the MSN index. After intense study I noticed that I obviously had a filter on my site from MSN.

  • tani hosting

    6/30/2011 7:40:17 AM |

    Let’s face the facts. MSN and Yahoo! have competing ad networks to Google’s, and this competitive situation is rife for a potential backlash against SEO sites with AdSense ads.

  • files send

    7/1/2011 3:01:23 AM |

    hey<P>Saw your blog bookmarked on Digg. Really cool Nice job. Check out my website if you get a chance, just click on name.

  • This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. Youve got a design here thats not too flashy, but makes a statement as big as what youre saying. Great job, indeed.

  • Dorinda Lillich

    7/1/2011 7:57:44 PM |

    You, my pal, ROCK! I found exactly the information I already searched all over the place and just couldn't locate it. What an ideal web-site.

  • termite inspection bronx

    7/2/2011 4:59:00 AM |

    Hello! Quick question that's totally off topic. Do you know how to make your site mobile friendly? My site looks weird when browsing from my iphone 4. I'm trying to find a template or plugin that might be able to fix this issue. If you have any recommendations, please share. Many thanks!

  • Randell Noblitt

    7/2/2011 8:01:39 AM |

    I'm really loving the theme/design of your weblog. Do you ever run into any browser compatibility issues? A number of my blog visitors have complained about my site not operating correctly in Explorer but looks great in Firefox. Do you have any recommendations to help fix this problem?

  • Audie Mccoskey

    7/2/2011 1:23:14 PM |

    Quite a beautiful website. I recently built mine and i was looking for some ideas and your website gave me some. Did you develop the website alone?

  • Nickolas Mckibbon

    7/4/2011 11:23:49 AM |

    hi! ;) I am at work currently, therefore i do not have much time to write… but! I truly liked reading your article. It was some excellent stuff. thanks!

  • Wilber Tuder

    7/4/2011 11:32:07 AM |

    Excellent blog you have here but I was curious about if you knew of any user discussion forums that cover the same topics talked about here? I'd really like to be a part of group where I can get comments from other experienced individuals that share the same interest. If you have any suggestions, please let me know. Bless you!

  • Joel Lataille

    7/4/2011 1:08:18 PM |

    I'm really enjoying the design and layout of your blog. It's a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work!

  • Francisca Kummer

    7/4/2011 1:49:08 PM |

    I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz reply as I'm looking to design my own blog and would like to find out where u got this from. many thanks

  • criminal lawyer brisbane

    7/4/2011 8:31:28 PM |

                            i remember that meeting Glenn and i am very impressed with your willingness to share that data with everyone                              

  • hostgator

    7/4/2011 8:36:25 PM |

    Rattling instructive and good complex body part of written content, now that's user friendly (:.

  • back tattoo

    7/5/2011 7:16:48 AM |

    I'm so happy to read this. This is the kind of manual that needs to be given and not the accidental misinformation that is at the other blogs. Appreciate your sharing this best doc.

  • livejasmin

    7/5/2011 9:24:48 AM |

    This actually answered my downside, thank you!

  • Gerri Chiarmonte

    7/5/2011 4:00:15 PM |

    Wonderful goods from you, man. I have understand your stuff previous to and you are just extremely fantastic. I actually like what you have acquired here, really like what you're saying and the way in which you say it. You make it enjoyable and you still take care of to keep it smart. I can't wait to read much more from you. This is really a tremendous website.

  • Recently during one of my client side scripting classes, I was trying to show my students some basic examples of JavaScript as an introduction to the language.   My first basic example was to show an alert box using JavaScript via the address bar.  The student’s reaction to my browser hack example really caught me off guard in a good way.

  • i5In44kxQA617

    7/10/2014 1:24:28 PM |

    959576 148887You Lastly want the respect off your family and buddies? 654858

Pingbacks and trackbacks (1)+

Comments are closed