0

I've tried almost everything for accessing VAR from iframe to parent

I've to transfer - var results = text - from the iframe to the parent.

What kind of code do I've to use? The var will be automatically filled from the iframe.

In the parent, I've to display the var with this code

document.getElementById("result").innerHTML = results;

                      OR

document.getElementById("destination").placeholder = results;

Thank you for so far!

Dhana
  • 1,618
  • 4
  • 23
  • 39
  • Hi Paul, please consider to provide more information. See https://stackoverflow.com/help/mcve – chriopp Oct 24 '18 at 21:47
  • Possible duplicate of [pass a javascript variable from an iframe to the parent frame](https://stackoverflow.com/questions/6271313/pass-a-javascript-variable-from-an-iframe-to-the-parent-frame) – Daniel Beck Oct 25 '18 at 00:00
  • 1
    Is the iframe displaying a page from the same domain as the parent? – zer00ne Oct 25 '18 at 00:50

2 Answers2

0

I'm completely new in javascript.

The url for the iframe will be http://www.viewworks.nl/wheel/wereld.html

On that page I have the answer box "antwoord" where the destination will be displayed.

I will use the same box on my wordpress homepage. They work in the same domain.

Does anyone know what the code will be for transporting the var results = text

On the wordpress homepage i will use this code for display the country.

document.getElementById("result").innerHTML = results;

                  OR

document.getElementById("destination").placeholder = results;

-1

try making an invisible div with results as an atribute and then get it.