简体   繁体   中英

How to redirect from mobile website to full site?

I was trying to figured out how to redirect from my mobile website to full site. When I create a button eg: "View Full Site" - it did not go to the full site, instead it go back to mobile website. I use Google Code: http://code.google.com/p/phpmobilizer/ to convert from normal website to mobile site. I was wondering if you know some php code that can redirect from mobile site to full site?

Here is the site I am currently working on http://www.roofpro.ca

Thanks! Christie

Just set a session if the user wants to go from mobile to desktop version. Do like this:

<a href="/index.php?goToDesktop=1">Go to desktop version</a>

Then, at the top of your index.php file:

<?php
session_start();
if ($_GET['goToDesktop'] == 1)
{
  $_SESSION['desktop'] = 1;
}

// then in your auto-mobile-detect, check for the variable first
if ($_SESSION['desktop'] != 1)
{
  // check for mobile and redirect
}

The problem you're facing is that you're being redirect back to your mobile domain again as soon as you're on your main domain with your mobile device.

You could try something like the following:

If the user wants to access the normal version, set a session variable and redirect him to the normal domain. On the normal domain, only execute the phpmobilizer as long as the session var for only accessing the normal domain hasn't been set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM