Last active
August 29, 2015 14:12
-
-
Save oldj/d1bf6f40b7febd6498c5 to your computer and use it in GitHub Desktop.
转到指定URL,同时不丢失refer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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