Okay
  Public Ticket #3833439
iFrames in Pop-ups
Open

Comments

  •  1
    Michael Pisner started the conversation

    I am looking for a way to refresh iframe content within a pop-up either upon closing or upon opening so that the iframe is reset. Click on the second button in the top row of my example. You will see I have an embedded pdf via iframe. If you scroll down the pdf, close the pop-up, then reopen it, the pdf is still scrolled to where you left off. I would like this to fully reset every time. I've tried solving this with some javascript but have been unsuccessful. Is this something you can help me with?

  •  145
    George replied

    Hello Michael,

    Please try the following: 

    Open Project Settings and go to Layout / Popup
    On the left sidebar, enable "Show advanced settings"
    Scroll down to Modal options and select "Reset Popup" from the Reset On Close options

    Save & Publish your project.

    I hope this helps.

    Best Regards,
    George | Kreatura Dev Team

  •  1
    Michael Pisner replied

    I was able to follow and implement these setting changes, but it doesn't seem to solve the problem. Please see my slider here: https://channelpartners.comcastbusinessevents.com/dx/

    If you click on one of the portal buttons and then click on a present to open a pop-up, you will see the state of the iframe does not reset after closing. Any other ideas would be greatly appreciated. Thank you!

  •  145
    George replied

    Hello Michael,

    I tried the popup on your site, but it doesn’t open with the “Reset Popup” setting. Did you make the configuration change I mentioned in my previous message?

    Best Regards,
    George | Kreatura Dev Team

  •  1
    Michael Pisner replied

    Hello—I believe I did. Please see attached configuration. I also just flushed the server cache just in case it was a caching issue. 

    Attached files:  Screenshot 2025-03-10 at 3.52.30 PM.png

  •  1
    Michael Pisner replied

    Also, I am having trouble configuring a button on my page that will trigger opening a popup. I see the settings to configure this, but it is not working. See attached. I looked at your documentation, but don't see any detailed info on how to handle.

    Attached files:  Screenshot 2025-03-10 at 5.47.41 PM.png
      Screenshot 2025-03-10 at 5.48.27 PM.png

  •  145
    George replied

    Hello Michael,

    There is a solution for the scrolling-problem:

    If the iframe content comes from a different domain, JavaScript won’t be able to modify its scroll position directly due to same-origin policy security restrictions. In this case, you can only control scrolling if the iframe’s page explicitly supports message passing using the postMessage API.

    The iframe’s page must handle incoming messages

    If you control the embedded page, you need to add an event listener to handle incoming scroll commands:

    window.addEventListener("message", function(event) {
        if (event.data === "scrollTop") {
            window.scrollTo(0, 0);
        }
    });

    Sending a scroll request from the parent page

    From the parent page (where the iframe is embedded), you can send a message to the iframe like this:

    document.getElementById("myIframe").contentWindow.postMessage("scrollTop", "*");

    The * wildcard allows the message to be sent to any origin, but it’s recommended to specify the exact origin (e.g., "https://example.com") for security reasons.

    This will only work if the embedded iframe page allows and handles the message as shown in the first code snippet.

    -------

    To open the popup when clicking a button, enter this in the Open By Click field:
    #popup01 – assuming this is the ID of the button.

    Best Regards,
    George | Kreatura Dev Team

  •  1
    Michael Pisner replied

    I appreciate this, however, I am still struggling to get this to work. I am just interested in using your popups to show scrollable PDF documents where the PDF starts back at the top if closed and reopened. It does not need to be an iframe if there is a better way to achieve this with you plugin. I tried experimenting with the Asset layer option, but the plugin freezes on me and just shows me a spinning preload circle. Is this a known issue? Is there any documentation about this asset layer functionality? Thanks!

  •  145
    George replied

    No, this is not a known issue. Assets should be loading without any issues.

    Best Regards,
    George | Kreatura Dev Team

  •  1
    Michael Pisner replied

    Please disregard...I was able to figure this out with your original response. Thank you so much for you help!