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.οnlοad=addpage_onload;
</script>
</head>
<body>
	
	<button  οnclick="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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值