`
人生难得糊涂
  • 浏览: 114694 次
社区版块
存档分类
最新评论

js框架传值在chrome中出现错误

阅读更多

我在一个页面中frameset包含了两个窗口

 

<html>
<head>
<meta http-equiv="content-type" content="text/type;charset:UTF-8">
</head>
<frameset cols="50%,*">
<frame src="a.html"></frame>
<frame src="b.html"></frame>
</frameset>
</html>

在一个子窗口中调用父窗口的属性

a.html

 

<html>
<head>
<meta http-equiv="content-type" content="text/type;charset:UTF-8">
<script type="text/javascript">
	//button事件
	function btn_onclick(){
		var showArea=document.getElementById("showTxt");
		showArea.value="";
		showArea.value+=(window.parent.location.href+"\n");
		showArea.value+=window.parent.getVisitedStr();
	}
	
	function addpage_onload(){
		alert(window.parent.location.href);
	}
	window.onload=addpage_onload;
</script>
</head>
<body>
	
	<button  onclick="btn_onclick()" >list page visited</button>
</body>
</html>

 

在chrome浏览器中出现错误

Blocked a frame with origin "null" from accessing a frame with origin "null"

 

 

查阅资料后得知chorme浏览器对于在文件系统中的主框架相互访问当做异域访问(既认为是不同服务器之间的访问),所以可以在Tomcat中发布后 再用http://127.0.0.1//xxx 的方式访问 或者之间用IE访问

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics