小编Fru*_*hko的帖子

当父来自不同的域时,在另一个iframe中执行javascript函数

页面A.com有2个iframes B.com/page1B.com/page2.这是A.com的代码:

<html><body>
    <iframe src="b.com/page1" name="iframe1" id="iframe1">
    <iframe src="b.com/page2">
</body></html>
Run Code Online (Sandbox Code Playgroud)

我想从B.com/page2B.com/page1上执行js功能.当父来自同一个域而不是跨域方案时,以下两个示例都很有效:

parent.window.frames['iframe1'].SomeFunction(args);
Run Code Online (Sandbox Code Playgroud)

要么

parent.document.getElementById('iframe1').contentWindow.SomeFunction(args);
Run Code Online (Sandbox Code Playgroud)

有什么办法吗?

javascript xss iframe cross-domain

6
推荐指数
1
解决办法
8583
查看次数

标签 统计

cross-domain ×1

iframe ×1

javascript ×1

xss ×1