w3c / IntersectionObserver

Intersection Observer
https://www.w3.org/TR/intersection-observer/
Other
3.62k stars 523 forks source link

IntersectionObserver is not defined #352

Closed dhruvg closed 5 years ago

dhruvg commented 5 years ago

This polyfill is working great most of the time. But I get the occasional error:

IntersectionObserver is not defined

This error is happening on Mobile Safari 12.0 and Chrome Mobile 38 (according to Sentry). But the funny thing is that it works fine on these browsers most of the time. It is just the one or two unlucky users who experience issues.

I am loading the polyfill with the following before I load all my custom JS:

<script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>

Any ideas on what could be the cause?

nickion commented 5 years ago

You have to expect an external resource to fail from time to time, so unless you're ok with that, include the polyfill in your own codebase and see what happens.

dhruvg commented 5 years ago

Wow, can't believe I took that for granted. Thanks.

JakeChampion commented 5 years ago

This issue has been opened in the wrong GitHub repository, it should be opened in https://github.com/Financial-Times/polyfill-service. It is possible for https://polyfill.io to fail from time to time but it does have a very high cache-hit ratio of 99.99998% for ~6 billion requests, if the failures are occurring frequently, I'd like to know more information if possible, such as if the requests are all from a similar location/device/time-of-day.

If you could close this issue and move it to https://github.com/Financial-Times/polyfill-service I would be very grateful :-)

dhruvg commented 5 years ago

@JakeChampion done