Hello,
Greasemonkey is a Firefox extension that allows you to write scripts that alter the web pages you visit. So, you can make on-the-fly changes to the HTML web pages. Greasemonkey can be found at https://addons.mozilla.org/firefox/addon/748 or you can simply Google (or Bing) it. Install it and then you will find an entry of it under Tools menu in the Firefox’s menu bar.
Searching over the web, you can come across many repositories of scripts. The script file can be a remote file or a local file. The script used is ECMAscript.
<GooadNews>ECMA script = JavaScript</GoodNews>
ECMA script is the official name for JavaScript. As in fig. 1, you can create your own script. Tool > Greasemonkey> New User Script will open a new window asking about the basic information about the script.
Fig. 2
Name: The name of your script i.e. the user script.
Includes: The URLs of the webpages which you expect the script to act over.
OK for the first time will prompt you for selecting the Text Editor. You can use Gedit (/usr/bin/gedit) or Notepad (Installation_drive:\Windows\notepad.exe) for editing.
Fig. 3
The name for the script is “Hello World” and it will act over http://www.google.co.in/* webpage. OK will open the text editor with some auto-generated comments.
Fig. 4
As mentioned earlier, it’s all JavaScript. The name of file containing the script must end in “user.js” (hello_world.user.js).
alert(‘Hello, World!’);
Fig. 5
You are, now, ready with your first user-script. Type http://www.google.co.in in your Firefox browser to see the alert.
Fig. 6
Script is executed on the DOMContentLoaded event of the browser over that webpage. The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. A web browser is not obliged to use DOM in order to render an HTML document. However, the DOM is required by JavaScript scripts that wish to inspect or modify a web page dynamically. In other words, the Document Object Model is the way JavaScript sees its containing HTML page and browser state.
Trying the fun part of it!!
Write a new script window.location=’http://www.twitter.com’ and write “http://www.facebook.com” in the include section. With this, whenever there’s a Facebook link, you will always get redirected to Twitter.
Here’s a script for downloading YouTube’s videos: https://docs.google.com/document/pub?id=1Hlmy2IbEk44-mI4IKpzJQ8HCJLzdgvW5binwP-_fLOI .
Fig. 7
Scripting languages always execute within the sandbox of the web browser. So, don’t raise your expectations. But, you can surely make the web-pages more interactive.






