Opera::User JS
Thursday, 26. February 2009, 15:21:59
One of the greatest features of Opera is User JS. User JavaScript allows you to specify local JavaScript files for Opera to include on every page that you visit.
Some web-pages do not provide a functionality that is requested by a user. For example the "vkontakte" social network always warns a user about "possible malicious site" every time a user clicks an external server's link. 4 lines of code solved the problem.
Some web-pages do not provide a functionality that is requested by a user. For example the "vkontakte" social network always warns a user about "possible malicious site" every time a user clicks an external server's link. 4 lines of code solved the problem.
// ==UserScript==
// @include http://vkontakte.ru/away.php*
// @include http://www.vkontakte.ru/away.php*
// ==/UserScript==
var link = document.links[0];
document.body.id = "body";
document.getElementById("body").innerHTML = "";
window.location= link;
The code is pretty self-explanatory, but in case if you're not familiar with JavaScript and Document Object Model, let me explain:
First, we include the urls that should be monitored by this script. This is a part of Opera User JS technique.
Then, we declare a link variable and store the first available link on the page to it. We know, that there is only two links on the page, and the first is the required one:

Then we search for a body tag and remove it's source HTML. So, we won't see the warning message.
And at last, the script automatically redirects us to the desired link.
That's pretty easy, isn't it? You can learn more about Opera's User JS here




How to use Quote function: