Last active
August 29, 2015 13:55
-
-
Save nitishn/8741605 to your computer and use it in GitHub Desktop.
This file contains 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
{% plugin rawtext mobile_url %} | |
{% plugin rawtext page_url %} | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
if(!$("body").hasClass("page_preview")) | |
{ | |
// DETECT IF ON MOBILE DEVICE. IF YES... | |
if( navigator.userAgent.match(/Android/i) | |
|| navigator.userAgent.match(/webOS/i) | |
|| navigator.userAgent.match(/iPhone/i) | |
|| navigator.userAgent.match(/iPad/i) | |
|| navigator.userAgent.match(/iPod/i) | |
|| navigator.userAgent.match(/BlackBerry/i) | |
){ | |
top.location.href="{{ mobile_url }}" | |
} else { | |
top.location.href="{{ page_url }}"; | |
}; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Redirection script for Wildfire projects.
The purpose of this script is to redirect users when they navigate to the canvas URL.
This script creates two plugins, mobile_url and page_url. Fill in mobile_url with the microsite URL and the page_url with page tab URL. Note: You'll lose your page preview on the wildfire backend!