URL filtering

URL filtering is a method that allows to restrict the users access to specified urls. Some usecases where URL filtering can be useful for content developers are:

Setting up a filter

First, configure Opera to use a filter file by editing opera.ini, to something similar to the following:

[Network]    
URL Filter File=$OPERA_HOME/urlfilter.ini

The next step is to configure the URL-filter file. Some example files are listed below:

example 1

[prefs]
prioritize excludelist=1

[include]
*

[exclude]    
file://localhost/dev
file://localhost/dev/*
file://localhost/proc
file://localhost/proc/*

This permits all usual Web traffic to foreign servers, but blocks access to /proc and /dev. As prioritize excludelist has been set to 1, the permission given to browse all files on localhost in the [include] section is overridden by the restrictions given in the [exclude] section.

Note that you need to specify two rules for each local directory to disable both access to files within it and also the actual listing of the directory. The first rule for the /dev directory above prevents the actual listing of the directory, and the second rule prevents any access to a file or directory within that directory.

example 2

[prefs]
prioritize excludelist=0

[include]
http://*.opera.com/*
opera:*
about:*
data:*
widget:*
attachment:*
file://localhost/home/opera
file://localhost/home/opera/*

[exclude]
*

This sample shows a different method of applying restrictions. First access to all resources is disabled by specifying * in the [exclude] section, then the content the user should be able to access is explicitly decided.

With this filter the user can only access pages within the opera.com domain or the local file://localhost/home/opera directory. That is, all access to, for example, HTTPS pages or FTP servers has been blocked.

This is a useful approach if full control on what the user should be able to access is needed.

Please note that this configuration depends on prioritize excludelist being set to 0, otherwise this would simply block all access to any Web content, both local and remote.

For more information, see the URL filtering topic in the Opera's Kiosk Mode tutorial online.