title: Redirecting a mobile user to a desktop version
body: <p>I have a Wordpress website that is using device detection to redirect users browsing on their mobile device to a specific page using the following:</p>
  
  <pre><code>&lt;script&gt;
  if( /Android|webOS|iPhone|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent) ) {
  window.location = "176.32.230.17/domain.co.uk/m";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>This code currently sits on the homepage template for domain.co.uk. Just after the opening body tag. The detection and redirection works well however, I need to provide a link back to the desktop version of the website on that mobile page. So just a simple link:</p>
  
  <pre><code>&lt;a href="http://176.32.230.17/domain.co.uk/?ref=desktop"&gt;Link back to desktop website&lt;/a&gt;
  </code></pre>
  
  <p>This works in that it directs the user back to the domain.co.uk address however, because the placement of the detection/redirection code is on the homepage template on domain.co.uk, the user gets redirected back to the mobile version. How can I fix this?</p>