Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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.

    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!!!

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    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 - Support
    You must always face the curtain with a bow.

  3. #3
    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??

  4. $spacer_open
  5. #4

  6. #5
    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
    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.


  7. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    @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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts