0

Hi there I'm trying to find a way to redirect unsuported browsers from a swiffy based html5 interactive.

Unfortunately I have no experience of browser/feature detection so I just have a basic skeleton for my code:

// this line would confirm compatible browser is present and sends to a swiffy html5 page:

if(navigator.appName == "Chrome 18.0+" ||  "Firefox 4+" || "Safari 5.1+" || "Internet Explorer 9+" || "Opera 12+" || "Mobile Safari iOS 5+" || "Android 4.0.3+")
{
 window.location = "timeline_web.html"
}
else{

// this line sends other browsers to fallback .png based version:

window.location = "timeline_web_fallback.html"
}

If you have any idea how to set this up I would be extremely grateful! Hope you can help

Joe
  • 457
  • 3
  • 8
  • 26
  • does this help? http://www.pageresource.com/jscript/jbrowse.htm –  Aug 22 '12 at 15:25
  • Hi thanks for your comment, i found a simpler solution using a jquery plugin which seems to be working so far :) thanks for your help though! – Joe Aug 22 '12 at 15:52

2 Answers2

2

Feature detection is usually better than browser version detection, as feature availability might depend on other factors like the doctype. You can test specific features, or use a library like modernizr

Christophe
  • 27,383
  • 28
  • 97
  • 140
1

My solution is to use a browser detecting jquery plugin here:

http://jquery.thewikies.com/browser/

to check against every browser version. Seems to be working well so far, with nice simple code :-)

Joe
  • 457
  • 3
  • 8
  • 26