Jump to content

Help with Javascript, Browser Detection and how to use it?


bentoscano

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...