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
Friday, July 17, 2009
Browser Highlighter Firefox extension / plug in
Thursday, May 14, 2009
VOO!
So the site I have been working on is now in public beta.
VOO! can be many different things, but I like to basically think of it as a collaborative blog (where you and your friends can post stories and photos and play games).
As always, this site is in beta so new features will be forever forthcoming.
Probably the best place to start is the gallery.
http://www.veryvoo.com/gallery
Sunday, April 19, 2009
jQuery: When does a library become a language?
jQuery is a great JavaScript library which allows web developers to write cross platform code, but some of its syntax looks like it is based more on Ruby than JavaScript. When does a library become a language?
Saturday, April 18, 2009
IE6 Update
Calling all web developers.
The folks over at this site have done something wonderful.
http://ie6update.com/
Basically, you include this code on your site, and all IE6 users see a drop down bar which looks like an ActiveX update and links to download IE8.
This is such a brilliant idea. If MicroSoft won't force people to upgrade, then we, as a community, should.
Tuesday, April 14, 2009
CSS Hacks = Lying
There are many similarities between using CSS hacks and lying.
First of all, what is a CSS hack? A CSS hack is a means by which you can get different browsers and browser versions to see and render your stylesheets differently so you can give them different directions (ironically though it's normally done to achieve pixel perfect cross platform web pages). They are also mostly done for Internet Explorer (which for some reason refused to implement standards based CSS until recently).
CSS hacks mostly exploit bugs in a particular browser such as the Star HTML hack. This hack was used to get code to run in IE6 and lower in a different manner than other browsers.
IE also introduced conditional comments which allow you to add an extra stylesheet to "fix" any CSS issues. This is not technically a hack, but it does require you to write and maintain extra CSS.
There are also more subtle types of hacks to make up for some things that are missing in IE like the IE min-height hack (which adds min-height style functionality to IE).
So why is using a CSS hack like lying?
Well, when you tell a lie not only are you telling an untruth, but you are essentially telling one person a different story than someone else. This is not admirable behaviour, but you can probably get away with it, once or twice. However as you have no control (mostly) which clients can see your site this is akin to lying to someone whilst there are other people in the same room. After telling the lie you then have to sneak over to all the other people and tell them a story and hope the first person doesn't cotton on.
Often with lying (as with CSS hacks) telling one lie requires you to tell another one (and to keep track of all the lies you tell). You then end up with a snowball effect wherein you lose track of what is true and what is not and you end up with more code than you ever needed.
Why use CSS hacks in the first place?
Because not only do these little CSS browser differences open hacks, they often are the cause for rendering differences between the browsers. There is a temptation to therefore use other hacks to fix these differences.
So there is often a judgement call to be made as to how far you can push a hack, and pile hack upon hack. At some stage compromises need to be made in the design.
So basically, I am not saying one should never lie, in web development (like in life) there are times when you need to use hacks and there are times when you need to lie. Just be careful not to do it too often (and document it carefully).
One more thing, if you are going to be using a lot of JavaScript to move your page elements around, you need to be doubly careful about using CSS hacks as there are some browser differences that don't reveal themselves when a page is static (but do so when a page is dynamic).