首页 > Web开发 > 详细

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

时间:2014-12-03 02:17:16      阅读:303      评论:0      收藏:0      [点我收藏+]

我在一个页面中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访问

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

原文:http://124654439.iteye.com/blog/2162445

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!