bentoscano Posted April 17, 2011 Share Posted April 17, 2011 Hey guys,Long time reader (and learner), first time poster here.I'm definiately a noob when it comes to web page development, but I'm currently putting something nifty together for a school project, and I need some help, specifically re: browser detection and how to use this. What I'm wanting to do is this:- User visits webpage- Script detects browser- If browser is firefox, deploy/use code A- Else if browser is safari, deploy/use code B- Else if browser is IE, deploy/use code C- Browser loads browser-specific codeI would really really appreciate any help I can get here from anyone! Thank you in advance Ben Link to comment Share on other sites More sharing options...
jeffman Posted April 17, 2011 Share Posted April 17, 2011 There is almost always a better solution than browser detection. Please explain the problem you are trying to solve. Link to comment Share on other sites More sharing options...
bentoscano Posted April 18, 2011 Author Share Posted April 18, 2011 There is almost always a better solution than browser detection. Please explain the problem you are trying to solve.Well, a small part of my code causes my page to only run correctly on Safari and Chrome, however if I alter this ever so slightly the page will display correctly on Firefox.if(AC.Detector.isCSSAvailable('')){ will display my page properly on Firefox, whereas if(AC.Detector.isCSSAvailable('-webkit-animation')){ will display my page correctly on Safari and Chrome. So, I want to be able to run each piece of code based on the browser used to visit the site.Thanks heaps Ben Link to comment Share on other sites More sharing options...
justsomeguy Posted April 18, 2011 Share Posted April 18, 2011 Check for the uncommon case first, so you can probably use something like this: if(AC.Detector.isCSSAvailable('-webkit-animation')){ ...}else if(AC.Detector.isCSSAvailable('')){ ...} Link to comment Share on other sites More sharing options...
bentoscano Posted April 18, 2011 Author Share Posted April 18, 2011 Check for the uncommon case first, so you can probably use something like this:if(AC.Detector.isCSSAvailable('-webkit-animation')){ ...}else if(AC.Detector.isCSSAvailable('')){ ...} Doesn't work unfortunately. Thanks for the help and idea though! Link to comment Share on other sites More sharing options...
bentoscano Posted April 20, 2011 Author Share Posted April 20, 2011 Nevermind, I just used a simple redirect based on the browser type and detection. Thanks for all the ideas and suggestions though Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.