• I’m on my fifth attempt to get an iframe to resize according to its contents but coming up short every time. Does anyone have a working solution for this?

    Currently working with https://iframe-resizer.com/ but does not seem to work any better than the other solutions I tried.

    Here’s the code I’m using on the parent page:

    <iframe id="myIframe" src="https://george-mainemonitor.github.io/my-reps/" style="width: 100%;height: 100vh;border:none;"></iframe>

    <script src="/wp-admin/js/iframe-resizer.parent.js"></script>
    <script>
    iframeResize({ license: 'GPLv3', waitForLoad: true }, '#myIframe');
    </script>

    Have triple checked this against the documentation at https://iframe-resizer.com/ and looked in my browser console but can’t seem to figure out what’s going wrong.

    Appreciate any advice or help with this.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • You have apparently placed a file called “iframe-resizer.parent.js” in the WordPress core directory wp-admin. I would strongly advise you not to do this.

    If you want to include individual JavaScript files, you need to do this with an individual plugin or child theme. There you can use the function https://developer.www.ads-software.com/reference/functions/wp_enqueue_script/ to include the file (examples can be found in the linked manual).

    To answer your question: in the JavaScript console you can see that the script you are using is obviously missing a script that it needs to work. I don’t know where you got this from, but it seems to be incompletely configured.

    In general, however, I would say that this kind of influencing the content of iframes is not feasible. If so, then only with extremely complex JavaScript, which is prone to errors. I would recommend that you look for other solutions for this.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.