1

I'm trying to make a web page that redirects to a mobile land page. It works, but on the mobile land page I want to go to the main page without using redirection but, of course, each time I go to the main page, it redirects me to the mobile land page (of course, as the script runs...).

So my question is: how can I link the mobile land page to the main page without redirecting when I link to it?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sonhja
  • 8,230
  • 20
  • 73
  • 131
  • Can you post your Script or refer it with some example...just to get some more clear understanding.. – Scorpio Sep 17 '12 at 17:15

1 Answers1

1

You could add a parameter on the url to the main page on the mobile site eg:

<a href="mainpage.html?mredirect=false">Go to full site</a>

Then on the main page check if the parameter exists before redirecting.

var mredirect = getParameterByName("mredirect");
if(!mredirect && isMobile){
  //redirect to mobile site
}

getParameterByName : How can I get query string values in JavaScript?

Community
  • 1
  • 1
Richard A
  • 2,100
  • 15
  • 13