Skip to content

Instantly share code, notes, and snippets.

@jarvis657
Created November 21, 2017 03:30
Show Gist options
  • Save jarvis657/aa91049da30cf6f3812430339f47763e to your computer and use it in GitHub Desktop.
Save jarvis657/aa91049da30cf6f3812430339f47763e to your computer and use it in GitHub Desktop.
点击防历史回退
(function () {
if (top.location != self.location) {
return false;
}
var tu = unescape(self.location);
if (htmlspecialchars(tu).length != tu.length) {
exit;
}
if (tu && ((tu.indexOf("http://union-click.jd.com/") === 0) || (tu.indexOf("https://union-click.jd.com/") === 0))) {
if (!window.attachEvent) {
document.write('<input style="display:none" type="button" id="exe" value="" onclick="window.location=\'' + hrl + '\'">');
document.getElementById('exe').click();
} else {
document.write('<a style="display:none" href="' + hrl + '" id="exe"></a>');
document.getElementById('exe').click();
}
}
})(hrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment