how to exclude a webpage in a userscript

Forums » Opera for Windows/Mac/Linux » Opera browser

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

31. May 2010, 00:03:09

epilos

Posts: 2044

how to exclude a webpage in a userscript

hello

can you tell me please how to exclude a webpage in a userscript?

thanks
Opera 11 on WinXP Pro SP3 • AMD hexacore 3.2Ghz with 4Gb RAM

31. May 2010, 02:16:25 (edited)

Vectronic

... ... ...

Posts: 2538

There are a lot of ways.

// @exclude http://www.site.com/*

or

if(window.location.href.match('my.opera.com')){
  do stuff...
}

or

if(document.domain != 'opera.com'){
  do stuff...
}

or

if(document.title != 'My Opera'){
  do stuff...
}

or

if(!window.variable){
  do stuff...
}
where "variable" would be a specific variable/tag/etc to that website

Among many many other ways... if you want to block a bunch, then put them in an array:

var ExcludeSites=['www.123.com','www.456.com','www.789.com'];

Then you can do a for() do() while(), etc loop through them to check if the current page/domain/etc is in your ExcludeSites array.

Edit: fixed a couple mistakes on my part... and you can find more <a href="http://userjs.org/help/tutorials/uri-detection">here</a>

Forums » Opera for Windows/Mac/Linux » Opera browser