I need an example of code that will add the URL of an IFrame to a text field on the parent page upon navigation from a 1st to a 2nd page in the IFrame.
All code must be added to the parent page, HTML Element, or the 2nd page that is navigated to in the IFrame. Code cannot be added to the 1st page shown in the IFrame. It is also important that the script runs automatically based on something like when the 2nd page is loaded or when the URL of the HTML Element is changed (not something like a button click).
Is this possible?
One challenge is that all of the examples include a button click when postMessage & onMessage are used. I have been able to postMessage automatically from the parent page to the HTML Element by placing the code in the onReady event handler of the parent page but I am unable to figure it out the other direction.
In advance, help is much appreciated.