Mobile browser redirect inside wordpress - code help
- or -
Post a project like this£60
- Posted:
- Proposals: 1
- Remote
- #101592
- Expired
Description
Experience Level: Intermediate
We require a developer with experience of javascript & wordpress to help us with some mobile redirect code.
A javascript redirect has been put in on a test desktop website (http://outzoz.com/dave being used just to test this) to detect when the browser is a mobile, and if so, directs you instead to another test site : http://outzoz.com/latinis
This is the code that's in the index.html of http://outzoz.com/dave to do a conditional redirect based on browser agent :
<script type="text/javascript">// <![CDATA[
var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) { document.location = "http://outzoz.com/latinis"; }
// ]]></script>
This works fine, but the problem we have, is that when you're on http://outzoz.com/latinis using a mobile browser and click the "click to view desktop site" link at the bottom of the page, it redirects back to http://outzoz.com/dave, then the above code will again force the redirect to the mobile version of the site.
So we need some kind of exemption check in the above javascript code, so that it knows if you've clicked the view desktop button, to not redirect you again.
A javascript redirect has been put in on a test desktop website (http://outzoz.com/dave being used just to test this) to detect when the browser is a mobile, and if so, directs you instead to another test site : http://outzoz.com/latinis
This is the code that's in the index.html of http://outzoz.com/dave to do a conditional redirect based on browser agent :
<script type="text/javascript">// <![CDATA[
var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) { document.location = "http://outzoz.com/latinis"; }
// ]]></script>
This works fine, but the problem we have, is that when you're on http://outzoz.com/latinis using a mobile browser and click the "click to view desktop site" link at the bottom of the page, it redirects back to http://outzoz.com/dave, then the above code will again force the redirect to the mobile version of the site.
So we need some kind of exemption check in the above javascript code, so that it knows if you've clicked the view desktop button, to not redirect you again.

Dave L.
0% (0)Projects Completed
2
Freelancers worked with
2
Projects awarded
50%
Last project
14 Nov 2011
United Kingdom
New Proposal
Create an account now and send a proposal now to get this project.
Sign upClarification Board Ask a Question
-
There are no clarification messages.