Don Marti

Fri, 12 May 2006

Firefox banner

(Updated to include link to "hacking" article and MSDN page. Original posting date: 17 April 2005)

Dave Shea points out in an article that there's an easier way to do this kind of thing.

How do you put a big Firefox banner on your site for users of a certain broken proprietary browser—without annoying people who already have Mozilla, Firefox, Konqueror, or some other standards-compliant browser? Take advantage of a bug in MSIE's CSS support. Put this in the stylesheet:

body > div.hide {
   display: none;
}

then put the banner and any other browser-related message in a div with class="hide" that's not inside any other element. As long as MSIE doesn't support > you can have all kinds of fun with this.

--
Don Marti <dmarti@zgp.org>

This banner is hidden from standards-compliant browsers. If you can see the banner, consider switching browsers.

photodropper DirectBuy Yahoo TMDA Lexmark Linux news from LinuxWorld.com Scientology AdTI SSH SCO CP2102 Linux Herbalife Jerry Reynolds VX30 PowerPoint Matt Harrison nutzwerk intelligent design Eaton Powerware