【发布时间】:2013-03-20 04:04:33
【问题描述】:
我正在使用 NODE JS 模块来创建 HTTP 服务器。服务器的响应是一个包含 JavaScript 的页面,该页面在 . 这是响应代码:
<html>
<head>
<script type='text/javascript'>
function test() {
document.body.innerHTML='<iframe id="ifool" src="URL" sandbox="allow-same-origin allow-forms allow-scripts"> </iframe>';
var c;
window.setInterval(function(){
c=document.getElementById("ifool").contentWindow.location.href;
window.history.pushState(0,0,c);
},100);
</script>
</head>
<body onload= "test()">
</body>
</html>
我正在使用带有 FF 的 Firebug。我收到以下错误:
Error: Permission denied to access property 'href'
c=document.getElementById("ifool").contentWindow.location.href;
【问题讨论】:
-
看来这也可能是由于打开了 Firebug:stackoverflow.com/a/2910650/376789
-
是的,我正在使用 iframe
-
@jmar777:这个答案来自 2010 年……我个人从未见过仅在打开 Firebug 时发生过这样的事情。很确定这只是旧的 SOP……
标签: javascript html node.js web