Skip navigation.

miscoded

the web is a hack

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.

document.all offers another IE quirkWork ups and downs

Comments

scipio 20. April 2005, 10:34

Love the defineMagicVariable function! Have already used it twice to fix a site. :happy:

quiris 20. April 2005, 10:34

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?

hallvors 20. April 2005, 10:34

Not sure about you, but http://wp.pl forwards me to www.wp.pl, adding www in the comment block makes it work for me.

quiris 20. April 2005, 10:34

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=&threadid=87827

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

scipio 20. April 2005, 10:34

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> without any problems. Am I doing something wrong?

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies