User JavaScript in Opera

Customizing Opera by writing JavaScript

Opera 8 introduced User JavaScript that allows you as the user to install scripts that will be run on pages that are displayed in the browser. The script will be executed before the scripts on the page are run, which allows you to modify the page, for example by removing faulty browser sniffers. There is similar functionality, but with slightly less features, for Firefox in the Greasemonkey extension.

My colleague Rijk has written an excellent page about User JavaScript and what you can do with it. Since my knowledge of JavaScript is rather limited, I cannot provide as much information as he is able to.

From Opera 11, extensions can be used to wrap the scripts up to make them easier to distribute.

Warning: Remember that User JavaScript files can be used for destructive purposes. Never install a script (or extension) you are unsure of how it works.

User JavaScripts

To enable User JavaScript, you need to first download a copy of the script to your local hard disk. When you have downloaded the file, you can configure Opera to use it by selecting Tools - Preferences - Advanced - Content - JavaScript options and then entering the directory containing your User JavaScripts in the dialogue displayed.

You can also manually modify your configuration by visiting opera:config, or by editing your opera6.ini file manually. You need to add or modify these settings:

[User Prefs]
; Set to 1 to enable User JavaScript
User JavaScript=1
Always Load User JavaScript=1
; Point to the directory containing scripts
User JavaScript File=C:\Program Files\Opera

Additionally, to be able to use User JavaScripts on secure (HTTPS) pages, you need to set the following:

[User Prefs]
; Set to 1 to allow User JavaScript on secure pages
User JavaScript on HTTPS=1

Outlook Web Access Quotefix

This User JavaScript fixes quoting for Outlook Web Access (OWA). After downloading it, you should change the @include line to list the proper URL template to your OWA installation.

I have only tested it with two server versions, the HTML code can vary a bit between servers. I have provided two versions of the script, tailored for the different variants, you might need to change the id for the textarea or the lookup regular expressions to make it work with yours.

The scripts should probably be rewritten as extensions. The simplest form of Opera extensions are just User JavaScripts wrapped in a container file, with an added control file. Since I do not currently have access to an OWA server to test it on, I am not going to do that, however. If you are interested in doing so yourself, please feel free to, but please do notify me.

Download standard version.
Download version for OWA 2003.

Related links

This page has been validated to conform to the HTML 4.01 specification peter@softwolves.pp.se

More about the Opera browser