你用chrome的F12的页面工具,就可以看到他提示的错误:
Unsafe JavaScript attempt to access frame with URL file:///D:/temp/p.html from frame with URL file:///D:/temp/c.html. Domains, protocols and ports must match.
所以,当你放到服务器上面或者放到HTTP服务器上面就没有问题了。
本文介绍了解决Chrome浏览器中使用F12开发者工具时遇到的跨域访问错误的方法。当尝试从一个文件路径访问另一个不同路径的文件时,会遇到安全限制。文章指出将项目部署到服务器或使用HTTP服务器可以避免此类问题。
你用chrome的F12的页面工具,就可以看到他提示的错误:
Unsafe JavaScript attempt to access frame with URL file:///D:/temp/p.html from frame with URL file:///D:/temp/c.html. Domains, protocols and ports must match.
所以,当你放到服务器上面或者放到HTTP服务器上面就没有问题了。
1万+
547
1327
1万+

被折叠的 条评论
为什么被折叠?
