Sunday, 2 May 2021

Javascript catch mixed content error to handle gracefully

Is there a way to globally catch mixed content errors?

To be clear: I don't want to allow the insecure content, all I want to do is handle the error gracefully.

Backstory: I'm integrating programmatic ads, that is i have to include some script tag, which returns some more JavaScript, which can load even more resources, etc...

It is impossible for me to control, what's coming to my website and sometimes those resources include http resources, which throw a mixed content error. I#m then left with an empty ads container, which looks kind of ugly. Also, I could try to resell this ad-space, since the first try failed.

I already tried window.onerror, but with no avail.



from Javascript catch mixed content error to handle gracefully

No comments:

Post a Comment