JavaScript Tips
XML Menu Builder
Build powerful, client-side DHTML menus using XML for data and CSS for style. No JavaScript data! No having to place list elements on every single page of your website! No plug-ins!

Snooping with the JavaScript Pseudo-Protocol

The JavaScript Pseudo-Protocol Specifier — javascript: is often used within JavaScript event handlers to return a URL when a user performs an action such as clicking a link.

The JavaScript Pseudo-Protocol Specifier is also useful for retrieving information about any loaded page. You can use it to enter, directly into the browser's address bar, a small piece of JavaScript source code that queries the state of the current document.

For example, if you want to see how many frames/internal frames this or any other page has, you could type the following into the browser's address bar, and hit enter:

javascript:alert(window.frames.length)

Entering the following into the browser's address bar will show you the contents of a document's cookie, if one exists.

javascript:alert(document.cookie)

Using the JavaScript Pseudo-Protocol Specifier can be an excellent way of reverse engineering the content of a page, and there is all kinds of fun you can have with it.