Skip to content

Instantly share code, notes, and snippets.

@dishuostec
Created December 17, 2014 14:31
Show Gist options
  • Save dishuostec/ecba0e298b003523b527 to your computer and use it in GitHub Desktop.
Save dishuostec/ecba0e298b003523b527 to your computer and use it in GitHub Desktop.
阻止中国联通的http劫持
// ==UserScript==
// @name Frame Killer
// @namespace http://www.arantius.com/
// @description 联通http劫持
// @include *
// @grant none
// ==/UserScript==
var frames=document.evaluate("//frame", document, null,
XPathResult.ANY_TYPE, null);
var f;
var src = [];
while (f = frames.iterateNext()) {
src.push(f.src);
}
if (src.pop() === location.href) {
alert('http劫持');
location.reload();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment