Friday, July 17, 2009

Browser Highlighter Firefox extension / plug in

On my site we noticed that some of our users had some JavaScript problems which was affecting content editing. After a bit of nosing around we found the problem was a Firefox extension called The Browser Highlighter.

This extension was created by eBay and it injects some JavaScript into the page which can affect the JS in your site. You can view this JavaScript in Firebug (it is in the script tag added just after the head tag)

What follows is a means of detecting this extension so you can protect your code from it.

Unfortunately, Mozilla Firefox does not provide an API into detecting browser extensions, but there is a work around.

If the extension injects a graphic into the page (which this one does), it does so by referencing it from the chrome protocol.

i.e.
chrome://shim/content/compareLang-1/eBayCompareIcon_yellow.gif

as opposed to the normal http protocol

So all you have to do is reference this image and place an onload event on it. If the event fires then the extension is installed.

So you can have the following script

<script>
var browserHighlighterPluginInstalled = false;

function alertUser() {
alert("You have The Browser Highlighter extension installed");
}

</script>

<img src="chrome://shim/content/compareLang-1/eBayCompareIcon_yellow.gif" onload="alertUser();" />

You may also want to include instructions on how to remove the extension (Tools -> Add-ons -> Extensions -> Disable).

PS This extension has not been getting very good reviews, please feel free to add your own...

https://addons.mozilla.org/en-US/firefox/reviews/display/11808