View Full Version : browser detect safari

mint suite
12-05-2006, 12:48 PM
I've built a site using flash backgrounds and it's causing a lot of problems in safari. As a short term solution I want to just load the backgrounds in as Gif/Jpegs while I find a better method.

I need to write a conditional stating that if the browser is safari show the gif/jpeg and if it's not safari show the flash.

My Javascript is pretty poor so any help would be great.


12-05-2006, 01:02 PM
Not the very bright method (it is not a god ideea to detect browsers using the userAgent), but, in a hurry, you may try this:

var bSaf = (navigator.userAgent.toLowerCase().indexOf('safari') != -1);
var bSaf12 = (bSaf && (navigator.productSub > 20030107));
... do something ...