Skip to content

Instantly share code, notes, and snippets.

@casperwilkes
Last active February 22, 2016 17:13
Show Gist options
  • Select an option

  • Save casperwilkes/d177e774641962907639 to your computer and use it in GitHub Desktop.

Select an option

Save casperwilkes/d177e774641962907639 to your computer and use it in GitHub Desktop.
Simple javascript redirect function. Inline and included
// Inline //
window.location.replace('location/to/redirect.html');
// Functions.js //
/**
* Redirects user to specified location.
* @param {string} redLocation Location to send user to
* @returns {void}
*/
function redirect(redLocation) {
if (redLocation !== 'undefined') {
location.href = redLocation;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment