Skip to content

Instantly share code, notes, and snippets.

@andershaig
Last active December 18, 2015 05:29
Show Gist options
  • Select an option

  • Save andershaig/5732665 to your computer and use it in GitHub Desktop.

Select an option

Save andershaig/5732665 to your computer and use it in GitHub Desktop.
Simple Redirect - This doesn't worry about social referral tracking, providing a different URL for mobile etc. It's just meant to be easier to understand and implement.
{% plugin rawtext desktop_redirect_url %}
<script type="text/javascript">
if (!document.body.className.match('page_preview')) {
// Redirects as soon as possible
setInterval( function () {
top.location.replace({{ desktop_redirect_url | json }});
},250);
}
</script>
@andershaig
Copy link
Author

Instructions

  1. Download your current template from the My Templates section of of the admin.
  2. Unzip the file.
  3. Create a new file in the template folder called fbcanvas.liquid. The content of your folder should now include something like 'default.liquid', 'fbcanvas.liquid' and a folder called 'assets'.
  4. Paste the code above into the fbcanvas.liquid and save.
  5. Select the liquid files and assets folder.
  6. Right-click and create a zip.
  7. Upload the zip you created as new version of your template.
  8. Update or create your page.
  9. Configure the "Desktop Redirect Url" plugin with the the full URL to the page you want people to view if using a desktop device (e.g. the URL to a fan page tab).

That's it!

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