Content blocking in Opera 9 Technology Preview 2
Sunday, February 5, 2006 12:08:00 AM
This post is a tutorial on how to use the content block feature introduced in Opera 9 Technical Preview 2. The feature is work-in-progress, but the Technical Preview will let you have a taste of how it works and make us gather feedback for future improvements.
Opera has had a feature that would let you block certain paths, protocols or servers for a long time. This feature has been configured using the "filter.ini" file and mostly used in kiosk mode or with third party tools. Documentation for this feature is part of the kiosk documentation found here.
The new content block feature in Opera 9 TP2 is based on the existing functionality that has been in Opera for a long time, but adds an easy-to-use user interface for maintaining this file.
To enable the feature, you need to set the page in "content block mode".

When you select the "Block content..." menu entry, the page will go into "content block mode". When the page is in this mode, all content that can be blocked (images and plugins) will appear normal, while text and other content will be greyed out.

You can now click on all the content you want to block and it will be added to the list of blocked content. Images and plugins will be drawn with a clear sign overlaid on the content when it is blocked.

A toolbar will be available when the page is in content block mode that will let you save, cancel or edit the filters that has been created so far.

If you press the "Details..." button, you will be able to edit the pattern Opera has created automatically to block content coming from the same path on the webserver.

As you can see, Opera has already created a pattern with a * wildcard to block all content that is loaded from the path starting at "http://portal.opera.com/img/". You may edit, delete or add new manual paths to be blocked in this dialog. * will match anything and ? will match a single character.
When you are done selecting the content to block, press "Done" in the toolbar.
If you would like to edit and delete all the paths to content that is currently being blocked by Opera, you may use the menu entry Tools->Advanced->Blocked content...

When you later load a webpage that contains blocked content, this content will not be loaded from the server and will be collapsed on the webpage.
Some changes have been made lowlevel compared to how the existing filter.ini filtering used to work:
- URLs are initially filtered in the layout engine and Opera will not attempt to load blocked content from the server. The layout engine will collapse the blocked content using the equivalent of the CSS "display: none".
- Lowlevel blocking of complete sites will still occur, so the existing functionality of filter.ini has not been changed. This could eg. be used to create rudimentary parental filters too.
- The default name for the configuration file is "urlfilter.ini" and if you have added content to block using the user interface, there is no need to configure a file or create a file.
Opera has had a feature that would let you block certain paths, protocols or servers for a long time. This feature has been configured using the "filter.ini" file and mostly used in kiosk mode or with third party tools. Documentation for this feature is part of the kiosk documentation found here.
The new content block feature in Opera 9 TP2 is based on the existing functionality that has been in Opera for a long time, but adds an easy-to-use user interface for maintaining this file.
To enable the feature, you need to set the page in "content block mode".

When you select the "Block content..." menu entry, the page will go into "content block mode". When the page is in this mode, all content that can be blocked (images and plugins) will appear normal, while text and other content will be greyed out.

You can now click on all the content you want to block and it will be added to the list of blocked content. Images and plugins will be drawn with a clear sign overlaid on the content when it is blocked.

A toolbar will be available when the page is in content block mode that will let you save, cancel or edit the filters that has been created so far.

If you press the "Details..." button, you will be able to edit the pattern Opera has created automatically to block content coming from the same path on the webserver.

As you can see, Opera has already created a pattern with a * wildcard to block all content that is loaded from the path starting at "http://portal.opera.com/img/". You may edit, delete or add new manual paths to be blocked in this dialog. * will match anything and ? will match a single character.
When you are done selecting the content to block, press "Done" in the toolbar.
If you would like to edit and delete all the paths to content that is currently being blocked by Opera, you may use the menu entry Tools->Advanced->Blocked content...

When you later load a webpage that contains blocked content, this content will not be loaded from the server and will be collapsed on the webpage.
Some changes have been made lowlevel compared to how the existing filter.ini filtering used to work:
- URLs are initially filtered in the layout engine and Opera will not attempt to load blocked content from the server. The layout engine will collapse the blocked content using the equivalent of the CSS "display: none".
- Lowlevel blocking of complete sites will still occur, so the existing functionality of filter.ini has not been changed. This could eg. be used to create rudimentary parental filters too.
- The default name for the configuration file is "urlfilter.ini" and if you have added content to block using the user interface, there is no need to configure a file or create a file.















CoreRouter # Tuesday, February 7, 2006 10:04:35 AM
Have been using Opera since Version 5 and now "I'm loving it (tm)"
:-) great work, keep going
greets from germany
Jan
kloned # Tuesday, February 7, 2006 12:30:11 PM
Non-Tropponon-troppo # Tuesday, February 7, 2006 2:24:19 PM
kloned # Tuesday, February 7, 2006 2:53:06 PM
LeoPetr # Tuesday, February 7, 2006 6:23:40 PM
Leo
LeoPetr # Tuesday, February 7, 2006 6:30:34 PM
Simon Houstonshoust # Wednesday, February 8, 2006 12:25:18 AM
Petter Nilsenmitchman2 # Wednesday, February 8, 2006 1:33:58 AM
hmm.
jesus2099 # Wednesday, February 8, 2006 4:54:59 PM
If this makes it through Opera 9 version I may be able to get rid of Proxomitron or manual filter.ini editing or anyother method I had to use but was insatisfied with!
Stefansguen # Thursday, February 9, 2006 1:17:16 AM
chaimav # Thursday, February 9, 2006 4:14:43 AM
Simon Houstonshoust # Friday, February 10, 2006 3:53:48 PM
Petter Nilsenmitchman2 # Saturday, February 11, 2006 1:59:22 AM
jesus2099 # Monday, February 13, 2006 4:53:46 PM
It does not bother me this mush though as I prefer looking to the source to block the javascripts that write he flash usually.
It's just a suggestion:
Oh yes I have another question. On my poor old modem I really appreciate the time I gain by blocking heavy ad contents.
My urlfilter.ini is getting bigger and bigger (http://jesus2099.free.fr/fichiers/urlfilter.ini). Maybe a big list would slow down Opera as it would have to test lots of URL matching?
Petter Nilsenmitchman2 # Monday, February 13, 2006 5:05:44 PM
A big urlfilter.ini will not necessarily increase loading speed as the content it blocks will not be loaded, thus saving speed in that area.
jesus2099 # Friday, February 17, 2006 1:38:22 PM
I don't remember which ones I encountered but You're right, I came to http://www.laposte.net and I was able to click and block.
But I remember clearly that every and each SWF I encountered untill now would navigate if I click on it with content block mode on.
Here is an example. It is not an ad, it's my radio. But, when you are in content block mode, when you click on it, it starts/stops the songs etc. It does not block/unblock the URL.
http://jesus2099.free.fr/radio/
Petter Nilsenmitchman2 # Sunday, February 19, 2006 1:40:43 AM
jesus2099 # Saturday, February 25, 2006 11:15:23 AM
Thank you all Opera dudes, I really think you are great!
Danny GuzmanSMF # Saturday, March 11, 2006 6:04:16 PM
I can't believe all the cool things Opera 9.0 Preview 2 has.
I was drawn in by the new content blocking feature but when I installed my Opera 9 about 2 weeks ago I had no idea where to look. So, today now that I have time I fired up my 9 and went looking for answers. Thanks for explaining all the new features Petter. I now have the Opera content blocking feature figured out and it is brilliant.
Now I can move on and read about the widgets and everything else you have posted here. This is very exciting. I don't have to tell you guys to keep up the good work. You guys rule!
SMF
Danny GuzmanSMF # Saturday, March 11, 2006 6:39:25 PM
Danny GuzmanSMF # Saturday, March 11, 2006 7:23:10 PM
[img]http://img64.imageshack.us/img64/1184/snaps0186ul.jpg
The fact that it insists in hidding it's self and I can not dock it any where I choose blows.
Fix this please
Danny GuzmanSMF # Sunday, March 12, 2006 1:33:06 AM
In closing. With Opera I can.
Again thanks for your blog with explinations it has been very helpful.
Oh and sorry I was complaining to you.
I should know better as Opera has never failed me yet.
kernelm # Friday, March 24, 2006 7:57:24 AM
jesus2099 # Friday, April 7, 2006 11:07:04 AM
Here are my filters with french explanations here: http://jesus2099.free.fr/blog/2006/02/bloquer-les-publicits-dans-opera.html
Follow the link to urlfilter.ini (down the page) to download.
Petter Nilsenmitchman2 # Friday, April 7, 2006 2:55:15 PM
etherealsilence # Monday, April 10, 2006 11:55:14 PM
If I may ask, why in the world WOULDN'T you add support for regular expressions? Nearly every major programming language has great libraries for regular expression support. I know that what seems like a trivial task to an outsider can often be a big pain, but in this case, I'm having trouble believing that it would be that hard to implement.
Having integrated regular expression support into several of my own projects (admittedly much, MUCH smaller than opera), I can say that it's a pretty painless process. The benefit gained would be huge for Opera, and the time cost should be very low. I know several holdouts in the firefox camp that won't switch because of the lack of regular expression support for filtering. The ability to import a good list like filterset.g (http://www.pierceive.com/filtersetg/) would be incredible. Please, PLEASE push for regex support. Many users beg you.
As for the improvements mentioned in the post above? Beautiful. Keep up the good work.
Petter Nilsenmitchman2 # Tuesday, April 11, 2006 3:30:52 PM
It's trivial to implement regexp, but not trivial for a normal user to add manual rules or having to consider backwards compatibility.
Jonathan ShareSharebear # Tuesday, April 11, 2006 3:47:48 PM
GrahamGort # Friday, April 21, 2006 11:39:32 PM
etherealsilence # Thursday, April 27, 2006 9:01:00 PM
The simplest solution is almost always the best. In this case, don't force anyone to use regular expressions... leave the current filtering alone. Just ADD support for regexp.
I'd suggest something simple, like preceding all regular expression filters in the filter.ini file with an "@" char.
If filter.ToCharArray()(0) == '@'
{
ParseRegExpFilter(filter)
}
Else
{
ParseNormalFilter(filter)
}
Can't get much simpler than that. Regular users don't even have to know that it's there. Just include a note somewhere in the help file or even just a sticky in the forums letting the power users know that the support for it is there.
intelbill # Tuesday, May 16, 2006 3:20:02 AM
hikingpete # Friday, June 2, 2006 6:10:46 PM
As for Regular Expressions, what the Adblock extension in Firefox does, is to simply consider anything beginning with a forward slash (/) a regular expression, other patterns are interpretted with normal wildcards. Honestly, I can't think of any normal pattern (in the context of URLs) that begins with a forward slash. Of course, I can't claim to fully understand the problem, but I also much covet the possibility of using Filterset.G.
Thanks for the great work.
jesus2099 # Thursday, October 19, 2006 8:34:18 AM
A usefull addition would be a nice [on|off] toggle in the F12 popup menu or in the site preferences !
Flavio SuárezYinYanger # Thursday, October 19, 2006 11:08:26 AM
It would be very useful, as I use an always updated list from http://pgl.yoyo.org/adservers/
jesus2099 # Thursday, October 19, 2006 7:02:08 PM
I prefer blacklisting only ads because I want to support Opera and let it shows in every statistics I can.
This is my list with only ads : http://jesus2099.free.fr/blog/2006/02/bloquer-les-publicits-dans-opera.html (Yes, again. Sorry)
Flavio SuárezYinYanger # Friday, October 20, 2006 11:58:42 AM
Gingerbread Guy # Friday, October 27, 2006 3:53:47 PM
Happy Halloween!
chosig # Tuesday, May 29, 2007 5:18:40 PM
ir čia priėjo, Saulius :)einu # Saturday, April 19, 2008 12:43:32 PM
example:
https://g.adspeed.net*
https ????? and = zero emotions to opera... SADDDDD rly SAAAD
jesus2099 # Wednesday, March 25, 2009 11:23:09 AM
I am not blocking my own content and I'm very happy to block all the ads.
Without this feature I would still be using proxomitron.
What do you mean, Filip007 ?
Kerwin Codotker # Tuesday, October 20, 2009 7:43:48 AM
So how do i exclude those sites from being blocked?
Petter Nilsenmitchman2 # Thursday, October 29, 2009 2:59:56 AM
Kerwin Codotker # Friday, October 30, 2009 11:50:43 AM
jesus2099 # Saturday, October 31, 2009 9:18:12 AM
LyovBlindWatcherX # Saturday, January 16, 2010 9:21:29 AM
aegide # Friday, June 25, 2010 10:34:47 AM
@chosig: for blocking div's etc i use the site specific stylesheet blocking. it's not that big of a deal to just create a .css-File with a
divid { display: none; }
in it. Works great for me. i only use it for regularly visited sites though, all others i use proxomitron whenever need be.
cheers