davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.
https://iframe-resizer.com
Other
6.62k stars 977 forks source link

Attempting to import latest parent script via CDN results in a 400 error #1260

Closed michaeldzjap closed 1 month ago

michaeldzjap commented 1 month ago

Describe the bug I'm attempting to load the parent script on my site via CDN, using the URL: https://cdn.jsdelivr.net/npm/@iframe-resizer/@iframe-resizer/parent@latest from the website. However, this results in a request with a 400 status. The child script seems to load fine. In this case parent and child scripts are loaded from the same domain.

To Reproduce On the parent page (i.e. the page containing the iframe):

<head>
    <script src="https://cdn.jsdelivr.net/npm/@iframe-resizer/@iframe-resizer/parent@latest"></script>
</head>

Additionally, I'm attempting to initialise iframe-resizer just before the closing </body> tag using:

<script>
    iframeResize({}, 'id-of-my-iframe');
</script>

Expected behavior I would expect the parent script to load without problems (i.e. 200 status instead of 400).

Desktop (please complete the following information):

Additional context Is this a bug or is this a licensing issue? I have no license yet, I want to try it out first. If it is a licensing issue then it would be good if this could be mentioned in the documentation more explicitly.

davidjbradshaw commented 1 month ago

Hi,

You can test it out by using the GPL licenses key license: 'GPLv3'. If you look in the browser console, it should explain this, but I will have a think about how to make it clearer.

Can you please let me know if that fixes it for you.

Cheer, Dave.

davidjbradshaw commented 1 month ago

OK that that was my bad in the docs, the link should be

https://cdn.jsdelivr.net/npm/@iframe-resizer/parent@latest

and

https://cdn.jsdelivr.net/npm/@iframe-resizer/child@latest

I had @iframe-resizer in their twice

davidjbradshaw commented 1 month ago

Fixed on live, thank you for spotting this.

michaeldzjap commented 1 month ago

Can confirm it works now for me. Thanks for the quick fix!