Steal This Bookmarklet

( Originally posted December 15, 2011 on one of my other blogs )

Have you ever wanted to change the way something reads on a web page? Just for giggles?

I wrote a quickie bookmarklet that should work on most browsers on most computers that’ll let you do just that.

First, find a page that you want to play with, like your Facebook wall:

Copy the text below …

javascript:(function(){var s,t,f;s=document.body.innerHTML;f=prompt("Bookmarklet written by Jim Lawless - http://lawlessguy.com )\r\n\r\nWhat word or phrase do you want to replace?");t=prompt("Replace with what?");while(s.indexOf(f)>=0){s=s.replace(f,t);}document.body.innerHTML=s;})();

and paste it into the address bar of the web page you selected.

After doing that, cursor over to the end of the last character ( the semicolon, in this case ) and hit ENTER.  You should be prompted with the following input window:

Image

I entered “Gentlemen” as the song “God Rest Ye Merry Gentlemen” is listed twice in the text of the topmost post on my wall.

Image

After you hit ENTER or click OK, you should be prompted for the word or phrase you’d like to replace the original word or phrase with:

Image

I entered the phrase “Goonybirds” …

Image

…and hit ENTER.

Here’s how that section of my wall looks ( but only to me ) after that last step ( I added the red rectangles to highlight the change ):

Note that this only changes things in your browser … nothing will change that others will see.

Please Note: You should never trust screen snapshots of web pages for this very reason; web page text is very easy to manipulate in the browser.

Have fun!

The source code of the above bookmarklet is copyrighted but is free to use under the X11/MIT open-source license. Please see http://www.mailsend-online.com/license.php

Advertisements

About Jim Lawless

I've been programming computers for about 36 years ... 30 of that professionally. I've been a teacher, I've worked as a consultant, and have written articles here and there for publications like Dr. Dobbs Journal, The C/C++ Users Journal, Nuts and Volts, and others.
This entry was posted in Technology and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s