Results 1 to 6 of 6
Hello everyone!
I am developing a website using CSS3 animations, video, canvas etc and the same website for mobile devices.
So, depending on the browser the content varies. For example:
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-25-2012 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 85
browser detection, client or server?
Hello everyone!
I am developing a website using CSS3 animations, video, canvas etc and the same website for mobile devices.
So, depending on the browser the content varies. For example:
If the user has a mobile browser the content is different.
If the user is using IE, I can not show animations.
Etc.....
I know that this must be a stupid question, but I have read a lot on the web. Is it better to do the Browser detection with server side (PHP) or JavaScript??
For what I have read, it seems to me that it is better to do in PHP, including files depending of the browser.
Thank you very much!!!
- 10-25-2012 #2
My advice would be to restrain yourself from implementing browser detection with your own regex matching of user agent strings.
Just dont
The problem is, you would have to maintain these regexes and the matching false positives or non-matchings can be a nightmare.
Instead invest the effort in building the infrastructure to use an existing solution like tera WURFL.
You probably have to pay for this service.
WURFL - Wikipedia, the free encyclopedia
ScientiaMobile - SupportYou must always face the curtain with a bow.
- 10-25-2012 #3Just Joined!
- Join Date
- Nov 2009
- Posts
- 85
Hi Irithori !! Thank you very much for your response. I have been taking a look at this: Detecting Browsers with WURFL - Building Android Apps with HTML, CSS, and JavaScript, 2nd Edition - OFPS - O'Reilly Media. And it seems to me that it is only for mobile detection, which is very useful for me.
But also I have to detect if the browser does not support animations like IE. How can I do that??
- 10-25-2012 #4Just Joined!
- Join Date
- May 2012
- Posts
- 43
Targeting IE Using Conditional Comments
It's just a HTML element.
- 10-26-2012 #5Just Joined!
- Join Date
- Sep 2008
- Posts
- 20
I also agree that browser detection should be avoided at all costs. It only leads to nightmarish code which becomes impossible to keep up.
Use feature detection instead
MSDN IE Link
I don't claim to know what you're working on, but I've read 2 books recently which have revolutionized my (and others) thinking towards regular web & mobile development. You might enjoy them, too.
Ethan Marcotte's Responsive Web Design
and
Luke Wroblewski's Mobile First
Both can be had here: A Book Apart
Short books which are chock-full of valuable info and tips for creating sites which work from mobile to tablet to desktop.

James
- 10-26-2012 #6
@J-Dude: Slight correction:
I didnt say: "Avoid browser detection at all cost"
I meant: "Dont do mobile browser detection *yourself*"
You must always face the curtain with a bow.


Reply With Quote
