Skip to content Skip to sidebar Skip to footer

Accessing Iframe Variable In Parent With Javascript

I'm aware there are incredibly similar questions on Stack Overflow already for this, but I've tried MANY of them, and am just getting nothing. I'm trying to grab a variable from t

Solution 1:

Try to access oad() from inside child when the page loads in iframe.

Add in child:

<bodyonload="parent.load()">

Also, you can change the code to pass and get the variable as parameter in load(prm) .

Solution 2:

I tried your code offline and i get an error "unsafe access" while accessing

window.myFrame

local pages can be tricky, however when i put the same files online they work well, domains and ports match. still i think its a bit weird using name="..." on the iframe, i would be using ID, but that doesn't seem to bother chrome and i got access to the variable with either onload on parent or child.

Post a Comment for "Accessing Iframe Variable In Parent With Javascript"