HTML5 data-attributes in iframe element
12,986
Yes, use the frameElement
attribute.
window.frameElement.getAttribute('data-something');
Demo: http://jsfiddle.net/Ehj2Q/
Of course this does not work at all if the iframe's content are from a different origin.
Comments
-
izk about 2 years
Can custom data-attributes set on an iframe be accessed by the iframe's content?
Example:
<iframe src="foo.html" data-something="123"></iframe>
Is there a way to access data-something's value form the iframe's document?
Thanks.