Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder Psionicsin's Avatar
    Join Date
    Aug 2010
    Location
    Detroit, Michigan
    Posts
    345
    Thanks
    54
    Thanked 0 Times in 0 Posts

    Distinguishing between devices for proper website

    I have two versions of a website. One for desktops, and one for mobile devices.

    I'm hoping I'm in the right place, but what do I have to do in order for the website to distinguish between a desktop computer and a mobile device? Also needing the easiest, simplest and cleanest code to implement.

    Again, if I'm in the wrong place, I'm sorry and please direct me to where I should be.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,474
    Thanks
    6
    Thanked 980 Times in 953 Posts

  • #3
    Regular Coder Psionicsin's Avatar
    Join Date
    Aug 2010
    Location
    Detroit, Michigan
    Posts
    345
    Thanks
    54
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Not quite what i was looking for as the mobile version of our site is already made, and has different content than what is on the regular site. So making our normal site mobile friendly via CSS just will not do.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,474
    Thanks
    6
    Thanked 980 Times in 953 Posts
    Then the best (although not 100% reliable) thing you can do is – *shudder* – user agent detection, either with the server side programming language of your choice or htaccess if your server is Apache. An internet search will give you many ideas.

  • #5
    Regular Coder Psionicsin's Avatar
    Join Date
    Aug 2010
    Location
    Detroit, Michigan
    Posts
    345
    Thanks
    54
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Then the best (although not 100% reliable) thing you can do is *shudder* user agent detection, either with the server side programming language of your choice or htaccess if your server is Apache. An internet search will give you many ideas.
    I think I've found a way IF it can be made. I found a java script that detects via screen resolution, but am looking for a PHP alternative of this. I just posted in the php forum actually. And yeah user agent detection is crap I agree lol.

  • #6
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually, there is a script that many developers use. They put it on the main website and it can detect when a mobile user is on the site and it automatically directs to the mobile site. I haven't done one myself yet, so I don't know what the script is, but hopefully someone else will.

  • #7
    New Coder
    Join Date
    Aug 2011
    Posts
    82
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Has anyone figured this out yet? I'm having the same problem. Differing css will not work in my case--I needed a separate site for mobile and I need to make the correct site load depending on what they're using. And obviously javascript's out since it's not supported on mobile...

  • #8
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    UA detection is pretty much your only viable option. The other option is to actually make your site usable in all browser and platform variants, instead of piling unnecessary crap into the desktop version and supplying a seriously cut down version to mobiles.

    Make your site fully functional without JS and the like being available, and then add any functionality enhancements which can be used by capable browsers. Do a search for 'progressive enhancement' or similar.

  • #9
    New Coder
    Join Date
    Aug 2011
    Posts
    82
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The problem with the regular site being used as a mobile site is that there are images used in the layout of the page, and they make the page "too big" according to mobile site validators I've used. And using CSS to hide the images does nothing but make them not visible--they still load and count toward the page size.

  • #10
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    You're pretty much stuck with UA detection then. It's the only thing you can rely on to any degree with regards to availability. The only downside being that some UA's might supply a different string to standard, but if the user has altered that part, they're likely going to know the consequences of their alteration anyhow.

  • #11
    New Coder
    Join Date
    Aug 2011
    Posts
    82
    Thanks
    2
    Thanked 0 Times in 0 Posts
    What I'm using right now is the free code from http://www.handsetdetection.com/... the only problem is that it's javascript and so some phones might not recognize it. It works on my Droid 3 and my mother-in-law's Droid X, but I don't know if older phones will be able to use it.


  •  

    Posting Permissions

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