Ad Blocking
OmniWeb allows you to block unwanted content that appears when browsing the web. You can block pop-up windows (including pop-under windows), commonly used for advertising, as well as images and other content such as Flash animations that are likely to be advertisements.
The Ad Blocking Preferences pane.
Block pop-up windows
Pop-up windows are created using JavaScript, which allows the web page author to specify the size and position of the window as well as whether or not things like the toolbars are visible on the new window. JavaScript can also be used to reorder windows, and frequently web pages will open a pop-up window and immediately send it behind the current window so you only see it when you close your main browser window. These are commonly called pop-under windows, but they are essentially identical to pop-up windows.
The following options are available for blocking pop-up windows:
- OmniWeb will block all pop-up windows, even if you click a link that should open one.
- With this setting, OmniWeb will block pop-ups windows that automatically open themselves when you load or leave a web page, but will allow pop-up windows to open when you request them by clicking a link on a page, for example.
- OmniWeb will allow all pop-up windows to open.
Show blocked pop-up windows in the status bar
Instead of simply blocking pop-up windows outright, OmniWeb includes an option that allows pop-up windows to be created and loaded, but they will not appear on screen. WIth this option enabled, whenever a pop-up window is opened but hidden, the blocked pop-up icon will appear in the status bar. Clicking this icon displays a menu with the title of each window. Selecting a window title from that menu will display the pop-up window that was hidden.
The status bar 'Blocked pop-up windows' icon on the left hand side
Animate images
Many advertisements on the web are animated images (called animated GIFs). Usually these animations loop endlessly which can be distracting when you want to be paying attention to other content on the page. OmniWeb allows you to control how many times these animations will loop, and even allows you to disable the animation altogether. The following options are available:
- OmniWeb will not interfere with the animations at all, allowing it to play as many times as the author specified.
- Only let the image play through it's animation sequence one time, then stop the animation.
- Only let the image play through it's animation sequence three times, then stop the animation.
- The animation will play for 20 seconds or less before stopping (depending on how long the animation itself is).
- Prevent animated images from animation at all.
Block images and other inline content
OmniWeb includes a powerful way to block content on web pages. Unlike most other ad blocking add-ons for other web browsers which simply prevent the content from being displayed, OmniWeb actually prevents the image or other file from being fetched from the internet meaning you save bandwidth, loading time, and also avoid cookies that many advertising servers use to track web surfers from page to page and site to site.
OmniWeb has 3 ways to block images and other types of content that appears on web pages. The following options are available:
- Many advertisements on the web are of a standard size, as defined by the Interactive Advertising Bureau. OmniWeb will automatically block any image whose dimensions match one of the known sizes for advertisements when this option is enabled.
- Often advertisements on web pages actually come from a completely different server than the page you're viewing came from. For example, companyx.com may host all of their advertising on someadcompany.com servers. With this option enabled, OmniWeb will automatically block any image that does not come from the same server as the web page that you are viewing.
With this option enabled, OmniWeb can specifically block or allow content based on it's address (URL). Two lists are provided; a blacklist for blocking content and a whitelist for allowing content. The whitelist overrides the blacklist.
More Information
OmniWeb uses two different lists of URLs: a blacklist and a whitelist. URLs that OmniWeb should not load content from are on the blacklist, while addresses you add to the whitelist will ignore all other rules for blocking content.
By default OmniWeb includes a short blacklist that covers known advertising servers on the internet, as well as common URL patterns for advertising content.
When content has been blocked by OmniWeb, the space it normally would occupy is replaced by a grey colored square with beveled edges. When you hold your mouse over the area, OmniWeb displays more information about the content that was blocked. You can click a blocked resource on a page to unblock and load it, or use commands available in the contextual menu. Using the
command in the menu or on the status bar of browser windows that contain unloaded images is a quick way to load all blocked image content on any page. For blocked plug-in content, simply click the area where the content would have been in order to load it.
The blacklist and whitelist can be edited by selecting the Edit Blocked URLs… button. For example, if you know that advertisements on a web page you visit often are being loaded from someadcompany.com's servers, you might choose to add someadcompany.com to the list of URLs from which OmniWeb should not load any content.
OmniWeb not only understands literal URLs that you enter, but can also be made to block all URLs matching a pattern. The patterns OmniWeb uses are known as regular expressions, or regexps or regexes for short.
Although regular expressions are cryptic, they are also powerful and concise. You don't need to know about regular expressions to use OmniWeb's ad blocking features, but regular expressions are available if you want to use them.
The following is a short overview of regular expressions. More in-depth explanations and tutorials can be found online. A good place to start looking is the Google Directory.
In a regexp such as ads\..*\.com some parts of the expression are taken literally, and other parts describe how the literal parts can be matched up against a URL or other piece of text. You may already be familiar with the simplified regular expressions known as filename wildcards (or globs). For example, the wildcard *.gif matches anything ending in ".gif". Here, .gif is taken literally, and * is a wildcard which means "anything can go in this space". Regexps are similar but have a few important differences.
The most important difference is that many more characters are "special" in a regexp than in a wildcard. Characters with special meanings in OmniWeb's regexps are:
* | Asterisk | ) | Right parenthesis | |
? | Question mark | [ | Left bracket | |
. | Period | ] | Right Bracket | |
\ | Backslash | | | Pipe | |
+ | Plus | ^ | Caret | |
( | Left parenthesis | $ | Dollar sign |
Notice that the period or dot, ".", is special: it means, "match any single character (letter, number, space, etc.) here". It will match an actual period, but it will also match any other single character. What can you do if you want to match an actual dot, so that you can block ad.pose.com without blocking adipose.com? You can put a backslash in front of any special character in order to deactivate its specialness. So you could use ad\.pose\.com to match just that one string. (Of course, this means that the backslash itself is also special, so to match "this\that" you have to use this\\that. Forward slashes, the kind normally found in URLs, are not special, so you don't need to worry about them.)
The other special characters you may want to use a lot are * and ?. These don't actually match anything by themselves. Instead, they affect how the previous character is used. * means "match any number, including zero, of the previous thing in the expression". ? means "the previous thing is optional: match none or one of it". They can be combined with other special characters, so that .* means "match any number of any character". You can also use it with a non-special character, so ad*led matches "adled", "addled", "adddddddled", and even "aled" (it can match zero "d"s).
You can now see what the example ads\..*\.com means. The first part, ads\. just matches "ads." anywhere in the URL — remember that the "\" is needed to keep the "." from being special. The middle part, .*, matches any amount of text. And the last part, \.com matches ".com". This means that the pattern will match "ads.foo.com", "ads.bar.com", "ads.this.that.com", or even "ads..com". It will also match parts of things you may not immediately think of, such as "fads.trends.com", or "www.egads.net/this.computer/is.silly.html".
To keep the expression from matching just a part of a longer string, you can use the special characters ^, which means "the beginning of the string", and $, which means "the end of the string". The pattern \.swf$ will match the text ".swf" but only if it's at the end of the URL. ^http matches any URL that starts with http. It won't match "ftp://example.com/http/thingy", because the ^ needs to be at the beginning of the string. The pattern ^$ only matches empty strings, and the pattern $x^ will never match anything, because the end of the string can't come before the beginning.
The remaining special characters can be used to match even more complicated patterns, but that's beyond the scope of this document.
If you right-click or control-click on an image a
item will appear either inline or in an submenu (if the image is also a link). Selecting this item will add the address for the image to your blacklist so it is blocked when it is encountered again in the future. Advanced users can identify image addresses on the blacklist that are common and edit those into a more generic expression that will block all of the images with a single expression on the list. Consider a blacklist with all of the following items on it:- http://adserver\.website\.com/da/6742/7H_leaderboard\.gif
- http://adserver\.website\.com/da/3840/fast_rock_tile\.gif
- http://adserver\.website\.com/da/6037/ar_book_cam\.jpg
The above expressions could be reduced to a single expression that would block all of those images and any others coming from the same location:
- http://adserver\.website\.com/da/
The same principle can be applied to the whitelist as well. The address of any blocked images you load using the
contextual menu item will be added to the whitelist.
OmniWeb's Ad Blocking settings will block Flash ads automatically when they meet the criteria used for blocking other types of content. The Matching known ad sizes setting does not apply, however.
If you would like to block virtually all Flash content you can add the following pattern to your blacklist:
\.swf$
That pattern will block any files that end in ".swf" which is the most common extension for Flash files. Blocked plug-in content shows up like any other blocked content and you can click the area in the page where the item would normally appear in order to load it.