Created
June 13, 2013 19:00
-
-
Save makbeta/5776391 to your computer and use it in GitHub Desktop.
JS for Luminate CMS: redirect users to a different page if they are viewing it in mobile browser
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
var currentPath = '${path}'; | |
var redirects = [{ "from":"/give-now","to":"http://localhost"}, | |
{"from":"/z-test/responsive-donation-redirect.html","to":"http://localhost"}]; | |
$.getJSON( "/components/mobile/check-setting.jsp", function(data) { | |
if(data.isMobileDevice) { | |
if(redirects.length > 0) { | |
for(i=0; i<redirects.length; i++) { | |
if(redirects[i].from == currentPath) { | |
console.log('DNL: We are on a mobile device, redirecting to '+redirects[i].to); | |
window.location = redirects[i].to; | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment