|
Arbitrary Javascript in a Web Page using a Firefox ExtensionJeffrey P. Bigham |
|
Related ArticlesRelated Ads |
The GreaseMonkey Firefox extension allows users to insert arbitrary Javascript code into web pages to alter them as they see fit. It's an incredibly handy extension. In this short article, I display a short piece of Javascript code that simulates much of this functionality because sometimes you don't need all of the power of GreaseMonkey, you just want to be able to muck around with a web page on-the-fly with Javascript. Reasonably experienced Javascript developers will know how to change the contents of a web page once they have access to the HTML document that they want to change, but this isn't straightforward to get. The Javascript code in the extension will exist on the XUL file that it's included in and getting from that to the browser's window, isn't exactly straightforward. Here's one way to do it that works pretty well:
That's all there is to it, however, for code that gets released in the wild, security is a huge concern because of the difference in protection models between the trusted Javascript code in an extension and the untrusted Javascript found in the wild. For more on this, see my companion article: |
|
|
||