Last active
August 29, 2015 13:57
-
-
Save jtyjty99999/9615107 to your computer and use it in GitHub Desktop.
点击链接不发送referer
This file contains 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
//用window.open的方式打开一个中转页面,再在里面执行代码打开(新窗口打开) | |
function open_new_window(full_link){ | |
window.open('javascript:window.name;', '<script>location.replace("'+full_link+'")<\/script>'); | |
} | |
//其中location.replace刷新页面的方式也可以替换成html自刷新的方式 | |
var html = '<html><head><meta http-equiv='Refresh' content='0; URL=" 路径 + "' /></head><body></body></html>' | |
var a = window.open(null, 打开方式(_self或者_blank)) | |
a = a.document; | |
a.clear(); | |
a.write(e); | |
a.close(); | |
//用iframe添加到body后,仍然用javascript的方式替换链接 | |
function open_without_referrer(link){ | |
document.body.appendChild(document.createElement('iframe')).src='javascript:"<script>top.location.replace(\''+link+'\')<\/script>"'; | |
} | |
//用data schema的方式替换href,仍然打开一个刷新器 | |
var html = '<html><head><meta http-equiv='Refresh' content='0; URL=" 路径 + "' /></head><body></body></html>' | |
html = encodeURIComponent(html) | |
$(链接).click(function (){ | |
this.href = html; | |
return !0 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment