User JavaScript in Opera 8 final

Opera 8 final introduces one new limitation and several enhancements for the User JavaScript functionality.

The limitation first: because we are worried about potential spyware abuse, User JavaScripts will not run on pages that are encrypted. This is a big and very annoying limitation, and we're thinking hard about what we can do about it.

Now the enhancements: you can tell Opera to load all files in a folder as User JavaScripts, Opera has a GreaseMonkey-compatible mode to take full advantage of GreaseMonkey scripts with minimal or no editing, and there are new functions that simplify fixing pages: window.opera.defineMagicVariable and window.opera.defineMagicFunction lets you set persistent variables and functions that the page can not overwrite.

For more information about User JavaScript, see

http://my.opera.com/hallvors/journal/44

http://my.opera.com/hallvors/journal/45

<http://people.opera.com/rijk/opera/userjs.html>

and the brand new tutorial on

<http://www.opera.com/support/tutorials/userjs/>

which has several demo scripts and covers all the new and old features.

Advertisements

5 thoughts on “User JavaScript in Opera 8 final

  1. I want to use to load particular script on one site. Są I set up at a beginning of a file

    // ==UserScript==
    // @include http://wp.pl/*
    // ==/UserScript==
    alert('test');

    It should load alert window during loading page wp.pl. but it doesn't work at all. I'm a bit confused. What's wrong?

  2. Yes. In this case you are right. But what about this example:

    // ==UserScript==
    // @include http://www.7thguard.net*
    // @include http://7thguard.net*
    // ==/UserScript==
    alert('bla');

    for http://7thguard.net works.
    for http://www.7thguard.net doesn't work.

    The problem is described in the thread: http://my.opera.com/forums/showthread.php?s=&amp;threadid=87827

    And I've got one more question concerning the thread: http://my.opera.com/forums/showthread.php?s=&amp;threadid=88943 Why the entry: Always Load User JavaScript=1 doesn't work?

  3. I have a problem with "// @include url""
    I have written the following script that should work for a number of sites:

    // ==UserScript==
    // @include http://www.leidschdagblad.nl/*
    // @include http://www.limburgsdagblad.nl/*
    // @include http://www.telegraafholding.nl/*
    // @include http://www.hdcmedia.nl/*
    // @include http://www.limburgadverteren.nl/*
    // @include http://www.nhd.nl/*
    // @include http://www.gooieneemlander.nl/*
    // @include http://www.haarlemsdagblad.nl/*
    // @include http://www.ijmuidercourant.nl/*
    // @include http://www.dvhn.nl/*
    // @include http://www.vakantierecreatie.nl/*
    // @include http://www.almerevandaag.nl/*
    // ==/UserScript==

    window.opera.defineMagicVariable(
    'bSupportedBrowser',
    function(){return true;},
    null
    );

    When I try it, it doesn't work. If I remove all @include lines except the first, I can open <http://www.leidschdagblad.nl&gt; without any problems. Am I doing something wrong?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s