Skip to content

Instantly share code, notes, and snippets.

@oldj
Last active August 29, 2015 14:12
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 oldj/d1bf6f40b7febd6498c5 to your computer and use it in GitHub Desktop.
Save oldj/d1bf6f40b7febd6498c5 to your computer and use it in GitHub Desktop.
转到指定URL,同时不丢失refer
/**
* goto URL without losting refer
* @see http://oldj.net/article/referrer-by-location-href-in-ie/
*/
function gotoUrl(url) {
if (!document.attachEvent) {
//define for none-IE browsers
location.href = url;
} else {
//define for IE
var refer_link = document.createElement("a");
refer_link.href = url;
document.body.appendChild(refer_link);
refer_link.click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment