Created
February 8, 2017 13:43
-
-
Save jsn/3ba6e08cbeadb9f8937db0802aa4660a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var mobileElem = document.getElementById('mobile-link'), | |
mobileUrl; | |
if (mobileElem !== undefined && mobileElem !== null) { | |
mobileUrl = mobileElem.getAttribute('href'); | |
} | |
if (getCookie('noRedirect') !== 'enabled' && mobileUrl !== undefined) { | |
(function(a,b){if(/mobile|ip(hone|od|ad)|android|blackberry|iemobile|kindle|netfront|silk-accelerated|(hpw|web)os|fennec|minimo|opera m(obi|ini)|blazer|dolfin|dolphin|skyfire|zune/i.test(a.substr(0,4)))window.location.href=b})(navigator.userAgent||navigator.vendor||window.opera,mobileUrl); | |
} | |
function getCookie(name) { | |
var value = "; " + document.cookie; | |
var parts = value.split("; " + name + "="); | |
if (parts.length == 2) return parts.pop().split(";").shift(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment