Iframe Killer User Script

There are some objects that may be attached into web pages which certain web browsers insist on placing in front of everything else on the web page. Some examples of this are:

Where such an object appears too close to certain other elements of the web page (eg. navigation) then this can result in what appears to be perfectly functional code in some web browsers to be completely unusable in other browsers. The selection list and Flash situations are not likely to cause problems when you visit web sites that use them because these problems occur in Internet Explorer and the issues will therefore most likely have been dealt with by the person who wrote the page in order to make sure that conflicts don't occur. The one of these that may be a problem for you visiting a web site is if you use an older version of the Opera browser and the person whose web page it is hasn't considered that browser in placing their iframes.

The best solution in that instance is to notify the owner of the page so that they can fix it to work in Opera. Of course there is still a question of how can you access the page properly while you are waiting for them to fix it or what can you do if they refuse to fix it? Well Opera does provide a facility for you to turn off iframes completely by going to Preferences in the Tools menu then selecting the Advanced tab, selecting Content and unchecking Enable Inline Frames. This action is a bit extreme though because it disables iframes on all of the web sites you visit rather than just the one where the iframes cause the problem.

An alternative and better solution is to use a user script installed into your browser to disable iframes just on those sites where there is a problem (for example the first site I saw with this type of problem had a Google Ad in an iframe directly underneath the dropdown menu at the top of the page so that most of the menu entries were hidden behind the ad). The other advantage of using a user script is that you can selectively disable iframes in other browsers such as Firefox that don't provide an option for doing so from the preferences).

The iframekiller.user.js script just needs to be installed into your particular browser. For Firefox/Greasemonkey simply right click the link and select "Install User Script". With Opera the easiest way is to go into the link and select "Save As" from the "File" menu to save the script into your user script folder.

You only need to make one change to the script to get it to work for the web pages on the site(s where you are having the problem. Simply find the line near the top of the script that reads:

// @include       http://example.com/

All that you need to do to get the script to work on a specific site is to substitute that domain name where I have example.com in the script. To get it to work on more than one site simply repeat the @include line as many times as needed and specify the domain name of each site where you want to disable iframes on a separate @include statement.

Disclaimers: This user script removes all of the iframes from pages on the specified sites. In some instances the iframes are needed in order for the site to function correctly. The author of this script does not accept any responsibility for any site whose functioning you break through the use of this script. If this script breaks the functioning of a site then you will need to find a different way to achieve your desired result.

Many sites display advertising in iframes. Please do not use this script to remove advertising from sites unless the placement of that advertising makes the site unusable in your browser. A lot of information on web sites is freely available because the owners make enough from the advertising to fund the operation of their site.

Final Note: If iframes are causing a usability problem on a site then please don't forget to let the webmaster of the site know. Most should be happy to fix problems with the usability of their site making the use of this script unnecessary.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow