关于javascript 操作 淘宝手机页面元素 iframe 跨域操作

在页面 iframe 过来的 会因为跨域而操作不了 这个页面吗

执行报错

Uncaught DOMException: Failed to read 
the 'contentDocument' property from 'HTMLIFrameElement':
Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.(…)

求大神指导

图片描述

阅读 4.5k
2 个回答

You can't. XSS protection. Cross site contents can not be read by javascript. No major browser will allow you that. I'm sorry, but this is a design flaw, you should drop the idea.

more

浏览器同源策略不容许你这样做,试试变通的办法。
如p3p,jsonp等。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题