开发者

Javascript-iframe communication

This is the script:

<script src="mysqite . com/1.js"></script>

It's placed on othersite . com and it display an iframe. If somebody clicks in the iframe on something, the script should write a div into othersite . com.

So my question is how to do this? I know i have read a solution somewhere 开发者_如何学Go4 this be4...


You have few ways:

  • window.postMessage (HTML5-supported browsers only)
  • Flash-based solution (not very nice, but 100% works on system with Flash installed)
  • changing hash (url#hash) of iframe (it's allowed) and detecting those changes inside it.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜