1、报错信息:html
“Blocked a frame with origin from accessing a cross-origin frame”dom
2、在stackoverflow上找到缘由ide
Same-origin security policy You can't access an <iframe> with Javascript, it would be a huge security flaw if you could do it. For the same-origin policy browsers block scripts trying to access a frame with a different origin. (同源策略) Origin is considered different if at least one of the following parts of the address isn't maintained: <protocol>://<hostname>:<port>/path/to/page.html Protocol(协议), hostname(主机名) and port(端口) must be the same of your domain, if you want to access a frame.
iframe调用父页面的函数:parent.functionNme();函数
ps:若是报以上错误,把iframe和父页面代码都放入工程项目中在本地跑起来便可解决同源问题。spa