Mobile Redirect

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
   I have a client with a site that has a mobile subdomain.

   There are a number of ways to redirect and an unholy number of devices.

What I thought was to through up a large mobile type link once. There is  
a mobile link in a normal font elsewhere.


function runSwitchLink(){
    if(window.screen.width < 800){
            document.write('<a href="javascript:location.href=' +  
"' '" + '"  
class="asked">Switch to Mobile Site</a>');
            document.cookie = 'asked=yes;path=/';


// document.getCookie defined elsewhere

Site requires cookies (cart), so cookies off is not an issue.

I think screen.width takes into account dppx oversampling, and I think  
it is available always, even before page load. Is this right?

Other ideas?


Re: Mobile Redirect

On Tuesday, March 25, 2014 6:18:38 PM UTC+1, Jeff Thies wrote:
Quoted text here. Click to load it

Haha - well said!

Quoted text here. Click to load it

I don't know if it's a good idea to use javascript
maybe it's working with my phone that way.
Google is always redirected to the mobile version on my screen
automatically - dunno how that works.

Quoted text here. Click to load it

Interesting to read your post.
I thought I will have to fight with the different CSS @media entries.
Long way ahead for me dude - don#t give up

Re: Mobile Redirect

On 3/28/2014 2:44 PM, wrote:
Quoted text here. Click to load it

For your benefit, since I think know one else here cares there are a  
number of ways that Google determines which page to serve. On way is to  
make a site map where the mobile pages are marked. Format like this:

All this assumes a separate mobile site...

<?xml version="1.0" encoding="UTF-8" ?>
  <urlset xmlns=" "

         <loc> </loc>

The second is to provide link alternative for each of your full site pages:

<link rel="alternate" media="only screen and (max-width: 700px)"
       href=" " />

and for the mobile pages, a link rel="canonical" back to the main page

If you have a single site that serves all devices then you would not  
need this, but not all sites are suitable to that approach. You would  
then use the media query approach.

Quoted text here. Click to load it

You can. For a simple site this may be the best approach. I've just  
converted a Wordpress blog that was  heavily styled in a 3 column layout  
over to mobile with a number of media queries and hiding/showing stuff.  
It's doable but you have compromises to make.

Quoted text here. Click to load it

Site Timeline