<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>奇豪門業</title>
</head>
<frameset rows="1,*" border=0 frameborder="0">
<frame name="winBackLoad" scrolling="no" noresize target="mainweb1" src="default_top.htm">
<frame name="mainweb1" src="http://www.serverB.com/index.asp" scrolling="auto">
<noframes>
<body>
<p>此網頁使用了框架,但您的瀏覽器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>
文件2:index.asp (運行在服務器B上,作用跳轉和生成sessionID)
<script>
if (top.location !== self.location) {
top.location=self.location;
}
//這個JS的目的是跳出框架運行
</script>
<%
if session("xm2")="" then
session("xm2")="eee"
'上面這一句的目的只是為了使用session,讓系統為這個IE生成一個sessionID,并且判斷一下是不是已經跳轉過,免得引起死循環。
%>
<META HTTP-EQUIV=REFRESH CONTENT="0;URL='http://www.serverA.com/index.htm'">
<%
,上面這一句是回到框架,注意:只能用上面這個跳轉的方法,別用下面的跳轉方法。
else
Response.Redirect "index2.asp"
'上面一句才是真正地跳轉運行服務器B上的程序!注意:也只能用這方法跳!
end if%>
經過以上的跳轉,本IE已經有了服務器B上的sessionID,也就是說,框架雖然是在服務器A上的主框架運行,但它可以確保服務器B上的session不丟失,達到跨域運行的目的。
新聞熱點
疑難解答