Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Javascript that will detect a mobile browse and redirect to another page, unless a querystring parameter of full=true exists
<script language="javascript">
if(! == "full=true") { // do not redirect if querystring is ?full=true
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/Blackberry/i) || navigator.userAgent.match(/WebOs/i)) { // detect mobile browser
window.location.replace("http://url-of-your-mobile-page"); // redirect if mobile browser detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.