1 post in this topic

Hey guys,

I need some assistance (as I am a total noob at this but fancied trying my hand)

I was trying to create an extension for Opera to Block all websites except a handful of white listed ones using the opera.extension.urlfilter

Working from the example here: http://dev.opera.com...url-filter-api/ I have the extension blocking all web sites '* ://*.*/*' tested and working.

The problem comes when I try and remove sites from the block list or add them to the allow (I have tried both ways) .block.remove and .allow.add in accordance with the API - http://dev.opera.com...-api-urlfilter/

The extension just continues to block everything. Could someone take a look and tell me wtf I am actually missing please :)


// Check that the URL Filter API exists
if (typeof opera.extension.urlfilter != 'undefined') {

// Put the sites we want to block in an array
var sites = ['*://*.*/*', '*://*.*.*'];

// Put the sites we want to remove in an array
var sitesremove = ['*://twitter.com/*', '*://*.twitter.com'];

// Asign the URLFilter object to a variable for efficiency
var filter = opera.extension.urlfilter;

// Loop through the array of sites and add each one to the "block" list
for (var i = 0, len = sites.length; i < len; i++) {
filter.block.add(sites[i]);

}

// Loop through the array of sites and add each one to the "remove" list
for (var i = 0, len = sitesremove.length; i < len; i++) {
filter.block.remove(sitesremove[i]);

}

}
[/CODE]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.