davidjbradshaw / iframe-resizer

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

Vue version, TypeError: Cannot destructure property 'title' of 'document.getElementById(...)' as it is null. #1273

Closed vodnicearv closed 2 weeks ago

vodnicearv commented 2 weeks ago

Sometime we received this error: index.esm.js:20 Uncaught (in promise) TypeError: Cannot destructure property 'title' of 'document.getElementById(...)' as it is null.

Screenshots

Screenshot 2024-06-19 at 15 12 07

Desktop (please complete the following information):

  <div class="my-12 sm:my-14" v-if="product.tilda && i18n(product.tilda)">
    <IframeResizer
        :src="i18n(product.tilda)"
        class="w-full"
    />
  </div>
davidjbradshaw commented 2 weeks ago

That's strange the error suggests the iframe is missing from the page. Anyway I've changed how I check iframe.title and added a check that the iframe is actually there, so this should hopefully be fixed in v5.1.2. which has just been published.

If it is still an issue, can you please make me a test page, as I'm unable to repro this.

I'm new to Vue, so would love any feedback on how you think the Vue component could be improved.

vodnicearv commented 2 weeks ago

thanks @davidjbradshaw ! you are awesome

davidjbradshaw commented 2 weeks ago

I'm still a bit confused by this, as you got that error 27 times, but that code is only called when you load a page into the iframe.

Does your site use a lot of pages in the iframe? Or is maybe Vue doing something I'm not expecting?

vodnicearv commented 2 weeks ago

no, I load only 1 page in iframe