Why frameElement is null?
Asked Answered
N

0

7

I have problem with access to an iframe attribute from inside the iframe.

HTML Structure

<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>

When I call frameElement iside the second iframe I get null.

window.frameElement.getAttribute("link"); //Cannot read property 'getAttribute' of null

Console snapeshot

How can I get link attribute from inside the second iframe?

upd It's code from Revive Adserver, this iframes loading via JS. If load it in iframe manually all works fine.

upd One solution is add needed parameters to src get parameter.

Nealey answered 14/10, 2017 at 10:53 Comment(2)
Post some code so we can understand the problem. Images are acceptable if: 1. There is code and the images are secondary source. 2. If they are actually viewable. When I clicked that blurry ness, I was expecting the image zoom in like all image embeds on SO,Nuli
@Nuli I added code. Blurried are only links.Nealey

© 2022 - 2024 — McMap. All rights reserved.