Problem with POPUP IFRAME calling a js function in src from parent html

  • I am using krpano POPUP IFRAME example code to open a popup with an HTML page (from same domain) inserted as src of the iframe.


    That is ok, the popup open and src page is properly dispayed in the popup, BUT problem is that I need to call a jscript function in the src HTML page from the parent tour.xml code.

    I am able to do this when the iframe is not created using the POPUP IFRAME example code but is inserted by me in the parent HTML. To do this I use this code to call the jscrip function in the iframe src page:
    document.getElementById('my_ifram_id').contentWindow.myfunction();


    Problem with POPUP IFRAME is that the "id" of iframe is not defined and the getElementById generate this error:
    Uncaught TypeError: Cannot read properties of null (reading 'getElementById')


    I have also tryed with "getElementsByTagName('iframe');" but same error.

    Any suggestion how to call a js function in the iframe src page from parent tour.xml?

    Thanks
    Marco

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!