I found out that if I put javascript:<javascript code> into the address bar in Firefox I can get some scripts to operate on the page. What commands can I use in this way and where are they documented?

For example, I have seen that you can put viewsource in there too but I can't get the correct syntax.

link|improve this question

62% accept rate
feedback

migrated from stackoverflow.com May 11 '11 at 8:18

This question came from our site for professional and enthusiast programmers.

closed as off topic by random May 15 '11 at 22:52

Questions on Super User are expected to generally relate to computer software or computer hardware, within the scope defined in the faq.

4 Answers

up vote 1 down vote accepted

That's not actually a command, it's a URI scheme. Firefox understands a number of URI schemes and they have various uses:

  • about: Special pages (see about:about for a partial list)
  • chrome: Internal UI components, including localisable text and customisable appearance
  • data: Used to simulate files. For instance, you could use data:text/plain,Hello! to simulate the effect of a file containing the string Hello!
  • feed: Used to refer to Atom or RSS feeds
  • file: Used to refer to local files (only works from other files obviously)
  • ftp: Used to download from FTP sites
  • http: Used to refer to websites (obviously)
  • https: Used to refer to secure sites
  • jar: Used to extract entries from within ZIP files (jar:!/path/to/entry)
  • javascript: Used to execute Javascript (obsoleted by onclick handler) moz-icon: Used by the UI to refer to icons for files or file types
  • resource: Other internal resources
  • view-source: Used to show the source of a page (view-source:URI)
link|improve this answer
feedback

This is the basis the Bookmarklet. More:

http://www.bookmarklets.com/

http://www.squarefree.com/bookmarklets/

link|improve this answer
+1: for squarefree.com – Umber Ferrule Oct 10 '11 at 9:39
feedback

Those are two things you talk about.
One is a Javascript thingie, a javascript command, which you can use on every page that uses JS. There is NO list about these commands, they vary from page to page. If you manage to discover the right values/variables/commands, you can do nasty tricks on some pages. Like the trick with RapidShare in the good ol' days where you could reset the timer to 0 sec, so the Free DL became Premium in a blink.

The other one is the about:blank, about:config, etc. The browser in-built dialogs, settings, etc.

link|improve this answer
feedback

This question could right-on turn into a Stackoverflow question.

Okay, well.

First of all, the commands you can do after "javascript:" are practically everything you can do in javascript. Look up the language! You can alter the currently shown webpage with this, but as somebody else stated: What works with those depends on what page you are on!

Javascript is the (de-facto?) standard for scripting HTML documents.

Look up the language itself, first!

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.