Just one problem. Right now, with this apache code in my .htaccess, mobile users can't see the desktop version, just the mobile version. I want to provide my mobile users a link to my desktop version, as the mobile version of my site is much slimmed-down and doesn't have everything.

Google has the same thing, it automatically redirects mobile traffic to google's mobile site, but it has a link to the desktop site. How can I create such a link?

NightStalker
—
2010-07-16T19:38:22Z —
#6

With this method you're using, you telling the server to redirect requests. If you do it in the code, you can put in conditions. Such as redirect them to your site with a query string, and if it exists, do not execute the sniffer code

Ernie1
—
2010-07-17T11:49:23Z —
#7

Another way is to display content based on what device the user is using

IamAdam
—
2010-07-17T16:28:18Z —
#8

Thanks guys, with your help I solved the problem. This is what I did if anyone has a similar issue:

I got rid of the apache redirect and went to php. I added this code on my index page:

Why is it everyone seems to be making the same mistakes over and over?

The problem with user-agent strings in redirection is that this method has been shown by research studies to be both inefficient and obtrusive (as it always misses the devices which give inaccurate data or fake their string to appear as a desktop browser). Apart from the fact you're doing the same thing that caused so many problems in the webs past (remember the "this site requires IE banners?" or JavaScript resolution redirects?), forcing your users to use a mobile version of a website if their device can happily use the "full experience" is insulting their intelligence. You should NEVER demand or redirect users based on your assumptions as to what their device can accept or use. Give your users the choice and option to decide whether THEY would prefer to use the normal design (which in many devices will work fine) or whether they would prefer a mobile friendly version - if their device is less willing to work with complex layouts. The script you've mentioned above will not account for the 250,000 mobile devices that exist, you're just discriminating against the minority of users who you've forgotten to "dumb down" without their consent.

Placing such demands on the end-user and FORCING them to use whatever you think is best for them is a violation of what is considered good usability. :nono:

NightStalker
—
2010-07-26T05:51:54Z —
#10

AlexDawson said:

Why is it everyone seems to be making the same mistakes over and over?

The problem with user-agent strings in redirection is that this method has been shown by research studies to be both inefficient and obtrusive (as it always misses the devices which give inaccurate data or fake their string to appear as a desktop browser). Apart from the fact you're doing the same thing that caused so many problems in the webs past (remember the "this site requires IE banners?" or JavaScript resolution redirects?), forcing your users to use a mobile version of a website if their device can happily use the "full experience" is insulting their intelligence. You should NEVER demand or redirect users based on your assumptions as to what their device can accept or use. Give your users the choice and option to decide whether THEY would prefer to use the normal design (which in many devices will work fine) or whether they would prefer a mobile friendly version - if their device is less willing to work with complex layouts. The script you've mentioned above will not account for the 250,000 mobile devices that exist, you're just discriminating against the minority of users who you've forgotten to "dumb down" without their consent.

Placing such demands on the end-user and FORCING them to use whatever you think is best for them is a violation of what is considered good usability. :nono:

I do not think that is what he is doing. Most the time I have found, that my users just do not realise there is a mobile version, and try to load the full designed site on their phones. In SA we have lots of older phones and 3G/GPRS costs are very high. So by trying to redirect the user to the mobile version of the site, could save them money.

But on the other hand your right, they might want to view the full version, thus giving them the link to the other version, if they want to

AlexDawson
—
2010-07-26T06:22:05Z —
#11

Well according to the code he provided, it is exactly what he's doing (whether he attempted it or not).

Offering the full experience and having a highly visible link on your pages saying "Using a mobile device? Save some data today!" is much better than making the assumption that "their using a handheld device, they MUST be being charged and they MUST need a diet!" Making assumptions is one of the worst things we (as professionals) do in regards to our audience. It's much better to give them the native experience they expect and simply make them aware of the slimmer and perhaps cheaper site than to push them into it and say "don't like being where we forced you? navigate back where you should have been to begin with". Any action which a visitor undertakes should be self-motivated and based on their end needs... redirecting based on what a developer thinks is in their best interests is the same as not giving them the choice in the first place. We should be empowering our users to make decisions for themselves, not forcing the experience we prefer upon them.

NightStalker
—
2010-07-26T07:47:42Z —
#12

AlexDawson said:

Well according to the code he provided, it is exactly what he's doing (whether he attempted it or not).

Offering the full experience and having a highly visible link on your pages saying "Using a mobile device? Save some data today!" is much better than making the assumption that "their using a handheld device, they MUST be being charged and they MUST need a diet!" Making assumptions is one of the worst things we (as professionals) do in regards to our audience. It's much better to give them the native experience they expect and simply make them aware of the slimmer and perhaps cheaper site than to push them into it and say "don't like being where we forced you? navigate back where you should have been to begin with". Any action which a visitor undertakes should be self-motivated and based on their end needs... redirecting based on what a developer thinks is in their best interests is the same as not giving them the choice in the first place. We should be empowering our users to make decisions for themselves, not forcing the experience we prefer upon them.

I agree. It is much better to do it that way, but not entirely incorrect to do it his way. I would also do what you suggested. Just make sure they know about the other option. But a lot of the time its a bad managment decision instead of the developer. And sometimes the developer just doesn't have a choice. lol. I have experienced that the hard way. lol

puttyapp
—
2010-07-27T01:13:39Z —
#13

id just like to point out if anyone else is interested in a way of doing without htaccess or php use this inside head tags

puttyapp, shame it won't work for the 8%+ group of people with JavaScript either disabled or unavailable. At least with htaccess and PHP you can guarantee everyone will get the desired effect (that you target), using JavaScript to redirect is about 1,000% worse of an idea than even trying to force the thing as-is.

I understand what you are saying, that is why I have the link to the full website. Another thing is that many features on my full website just don't work on mobile... So I created a much more slimmed-down version of my website for my mobile users. The case is the same with many other websites.

Also, pretty much all the "big" websites use these scripts. Yahoo, google, msn, amazon, fifa, banks, etc, etc. As a result, most mobile internet users are accustomed to seeing a mobile website automatically. As such, the vast majority of people wouldn't even look for the mobile version because they are used to having the mobile version appear by deafult on their phone.

fattyjules
—
2010-07-31T00:03:59Z —
#17

I'm with you on this one, IamAdam.

If the visitor appears to be a mobile device, send them to the mobile site with a link at the top to visit the full site.

That way they get an experience consistent with other well-known sites they visit (being served mobile content), but can choose the full site if desired.

johnsmith153
—
2010-08-06T21:03:46Z —
#18

For the record, I do this:

(1) Crap mobile browsers (Blackberry (not 6), IE Mobile) = use PHP to redirect to the mobile site as these have no chance of viewing a full site.

(if this is accidently not picked up then no problem as there are further checks)

(2) Use screen.width<1000 AND PHP server-side code to detect a mobile.

(if this is accidently not picked up then no problem as there are further checks)

(3) If it detects a mobile I show a quick page with 2 large buttons saying "FULL SITE" or "MOBILE" = the user can then choose and a cookie remembers their selection (I know some people will not like this as it is one more page click). Once they have clicked they see their choice without any other distractions (and a link in the top left corner of every page/site allows them to return to the menu and choose again).

(4) If nothing detected then show full site. Also, if showing the full site and no JS available then I show a message at the top saying "No JS, turn it on or view the mobile site." (<noscript>).

The only way that I can have a problem is if JS is ON and none of my checks pick it up - which is unlikely. Most devices are picked up (SkyFire is an **** and I need to use $SERVER["HTTPX_SKYFIRE_PHONE"]) but if one isn't picked up then my full site looks great on most mobiles anyway.

The mobile site looks great on an 800x600 monitor with no JS so it's really a 'basic' site as well.

I test on more than 20 mobile browsers and all do as I expect them to.

The mobile site needs no JS, full site is mostly ok without JS but it does improve the experience.

AlexDawson
—
2010-08-12T10:44:13Z —
#19

IamAdam said:

Also, pretty much all the "big" websites use these scripts. Yahoo, google, msn, amazon, fifa, banks, etc, etc. As a result, most mobile internet users are accustomed to seeing a mobile website automatically. As such, the vast majority of people wouldn't even look for the mobile version because they are used to having the mobile version appear by deafult on their phone.

While it is becoming a trend, I think it's rather unfortunate that it's occurring because of the way most of those sites implement such functionality. The general concept most professionals adhere to is progressive enhancement, the idea of assuming a browsers capabilities and pushing them toward a design orientated for that display is more of a case of the broken model of backward compatibility (patching). While I am all in favour of helping deal with the limitations mobile devices may face within the main site (using perhaps CSS3 media queries) - in a manner which doesn't detract from the overall design, I am totally against such "hit and miss" redirections by default on the principle that it's just leading down a dark path of a future where we'll require automated scripts to deal with every possible device (after all, while a mobile friendly website may be fine for an iPhone, an iPad which is identical in all ways except viewport size will really be hindered by the optimized minimal experience). The future of devices aren't going to be a one size fits all situation (like is current for phones), it's going to be devices from 3inches to 300, from tiny pixel devices right up to huge televisions (which are becoming more web aware as we speak), and we can't expect to rely on redirections to treat them individually.