Skip to content

Instantly share code, notes, and snippets.

@noahub
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahub/5402e42b62f297661515 to your computer and use it in GitHub Desktop.
Save noahub/5402e42b62f297661515 to your computer and use it in GitHub Desktop.

Simple redirect to a URL:

<script type="text/javascript">
  window.location.replace('http://www.google.com/');
</script>

Redirect to a URL and pass through URL parameters and #anchor fragments

<script type="text/javascript">
  window.location.replace('http://www.google.com/' + window.location.search + window.location.hash );
</script>

For either script, the placement should be head.

Be sure to add it to a single page and not to Script Manager.

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