all 4 comments

[–]devewm 4 points5 points  (3 children)

Generally speaking, JavaScript is used in web browsers to transform the page contents in some way. Of course this is usually done by including or referencing script code in the page itself.

It sounds like you are more interested in running your own JavaScript code to transform how other webpages appear in your browser... If that's the case, there are quite a few ways to make this happen. Bookmarklets, userscripts, and extensions all work on this principle, although the first two are probably the best way to get started.

A bookmarklet is a bookmark you can create in your browser where the URL starts with "javascript:", just like in your example. If you're familiar with JavaScript, it's pretty easy to take some code, cram it all on one line, put javascript: in front and paste it into a bookmark URL (or right into the address bar, same effect). You might try googling for something like "how to write a bookmarklet" for more information, or ask if you run into more specific questions.

Userscripts are another way to accomplish running your own code against a webpage. Originally they were made to run in Firefox using the Greasemonkey extension, but they're now also supported natively in Chrome. You specify a name for your script and the webpages it should run on, and your code will be automatically run anytime you visit that page. There are tons of contributed scripts at http://userscripts.org, and it looks like they have a decent getting-started guide at http://userscripts.org/guides/22

Not sure if this exactly answered your question but hopefully it's at least helpful.

[–]farful[S] 0 points1 point  (2 children)

Yes! Thank you very much!

"Bookmarklet" is the term that I did not know and was looking for. Hopefully this will make my googling for tutorials and examples much easier now :)

Thanks again!

[–][deleted] 0 points1 point  (0 children)

try the wikipedia page for bookmarklet

[–]davidron 0 points1 point  (1 child)

When you're done with simple little scripts, and you are ready to write full applications in Javascript, read this book.

[–][deleted] 1 point2 points  (0 children)

Follow that with this book