为什么 frameElement 为空?

Ale*_*x B 5 iframe getattribute

我在从 iframe 内部访问 iframe 属性时遇到问题。

HTML 结构

<ins><iframe scrolling="no" frameborder="0" width="728" height="90" style="border: 0px; overflow: hidden;">
    #document
	<!DOCTYPE html>
	<html><head><base target="_top"></head>
	<body border="0" margin="0" style="margin: 0; padding: 0">
	<iframe id="ra_frame" src="//banners.com/index.html" link="URL" style="width:728px!important; height:90px!important" ;="" frameborder="0" scrolling="no"></iframe>
	</body></html>
</iframe></ins>
Run Code Online (Sandbox Code Playgroud)

当我在第二个 iframe 旁边调用 frameElement 时,我得到空值。

window.frameElement.getAttribute("link"); //Cannot read property 'getAttribute' of null
Run Code Online (Sandbox Code Playgroud)

控制台快照

如何从第二个 iframe 内部获取链接属性?

upd 这是来自 Revive Adserver 的代码,这个 iframes 通过 JS 加载。如果手动将其加载到 iframe 中,一切正常。

upd一种解决方案是将所需的参数添加到 src get 参数。