...

View Full Version : Distinguishing between devices for proper website



Psionicsin
08-27-2011, 06:27 PM
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.

VIPStephan
08-27-2011, 11:28 PM
Use CSS media queries (http://css-tricks.com/6731-css-media-queries/) (a. k. a. responsive web design (http://www.alistapart.com/articles/responsive-web-design/)).

Psionicsin
08-29-2011, 05:14 PM
Use CSS media queries (http://css-tricks.com/6731-css-media-queries/) (a. k. a. responsive web design (http://www.alistapart.com/articles/responsive-web-design/)).

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.

VIPStephan
08-29-2011, 09:46 PM
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.

Psionicsin
08-30-2011, 09:03 PM
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.

Swvmeain
09-07-2011, 04:43 AM
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.

OpalCat
01-05-2012, 02:47 AM
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...

MattF
01-05-2012, 06:12 AM
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.

OpalCat
01-05-2012, 05:23 PM
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. :(

MattF
01-05-2012, 06:38 PM
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.

OpalCat
01-05-2012, 09:43 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum