开发者

iframe calling parent javascript

开发者 https://www.devze.com 2023-02-20 19:13 出处:网络
开发者_如何学PythonIs it possible for me to setup an iframe so it calls a javascript function available in the window.parent.document scope?If I am understanding the question correctly, assuming funct
开发者_如何学Python

Is it possible for me to setup an iframe so it calls a javascript function available in the window.parent.document scope?


If I am understanding the question correctly, assuming functionName() is defined within the parent of iframe, you can do this within your iframe:

window.parent.functionName();

This will only work though, if both parent and iframe are on the same domain: http://softwareas.com/cross-domain-communication-with-iframes

0

精彩评论

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

关注公众号