Content blocking in Opera 9 Technology Preview 2
Sunday, 5. February 2006, 00:08:00
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.
Have been using Opera since Version 5 and now "I'm loving it (tm)"
:-) great work, keep going
greets from germany
Jan
By CoreRouter, # 7. February 2006, 10:04:35
By kloned, # 7. February 2006, 12:30:11
By non-troppo, # 7. February 2006, 14:24:19
By kloned, # 7. February 2006, 14:53:06
Leo
By LeoPetr, # 7. February 2006, 18:23:40
By LeoPetr, # 7. February 2006, 18:30:34
By shoust, # 8. February 2006, 00:25:18
hmm.
By mitchman2, # 8. February 2006, 01:33:58
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!
By Ti, # 8. February 2006, 16:54:59
By sguen, # 9. February 2006, 01:17:16
By chaimav, # 9. February 2006, 04:14:43
By shoust, # 10. February 2006, 15:53:48
By mitchman2, # 11. February 2006, 01:59:22
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?
By Ti, # 13. February 2006, 16:53:46
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.
By mitchman2, # 13. February 2006, 17:05:44
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/
By Ti, # 17. February 2006, 13:38:22
By mitchman2, # 19. February 2006, 01:40:43
Thank you all Opera dudes, I really think you are great!
By Ti, # 25. February 2006, 11:15:23
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
By SMF, # 11. March 2006, 18:04:16
By SMF, # 11. March 2006, 18:39:25
[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
By SMF, # 11. March 2006, 19:23:10
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.
By SMF, # 12. March 2006, 01:33:06
By kernelm, # 24. March 2006, 07:57:24
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.
By Ti, # 7. April 2006, 11:07:04
By mitchman2, # 7. April 2006, 14:55:15
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.
By etherealsilence, # 10. April 2006, 23:55:14
It's trivial to implement regexp, but not trivial for a normal user to add manual rules or having to consider backwards compatibility.
By mitchman2, # 11. April 2006, 15:30:52
By Sharebear, # 11. April 2006, 15:47:48
By Gort, # 21. April 2006, 23:39:32
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.
By etherealsilence, # 27. April 2006, 21:01:00
By intelbill, # 16. May 2006, 03:20:02
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.
By hikingpete, # 2. June 2006, 18:10:46
A usefull addition would be a nice [on|off] toggle in the F12 popup menu or in the site preferences !
By Ti, # 19. October 2006, 08:34:18
It would be very useful, as I use an always updated list from http://pgl.yoyo.org/adservers/
By YinYanger, # 19. October 2006, 11:08:26
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)
By Ti, # 19. October 2006, 19:02:08
By YinYanger, # 20. October 2006, 11:58:42
Happy Halloween!
By Gingerbread Guy, # 27. October 2006, 15:53:47
By chosig, # 29. May 2007, 17:18:40
example:
https://g.adspeed.net*
https ????? and = zero emotions to opera... SADDDDD rly SAAAD
By soul.., # 19. April 2008, 12:43:32