Skip to content

Instantly share code, notes, and snippets.

@nitishn
Last active August 29, 2015 13:55
Show Gist options
  • Select an option

  • Save nitishn/8741605 to your computer and use it in GitHub Desktop.

Select an option

Save nitishn/8741605 to your computer and use it in GitHub Desktop.
{% 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>
@nitishn

nitishn commented Jan 31, 2014

Copy link
Copy Markdown
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment