Prevent Http Basic Authentication From Displaying Prompt For Images
If I have an image from a different domain on a page, and that image is protected by HTTP Basic Authentication, the browser will present the authentication dialog to the user, look
Solution 1:
If you add the crossorigin="anonymous"
attribute to the image, it will no longer prompt for credentials, although it also means that no cookies or cached credentials will be sent either (which doesn't matter in my case).
Note however that, this restricts it to only images that have been served using the Access-Control-Allow-Origin
header, which must be set to *
or the page's origin. If the header is omitted or incorrect, the image will not be rendered, and a broken image error will be displayed instead. This makes this solution fairly useless, but unfortunately there doesn't seem to be an alternative.
Post a Comment for "Prevent Http Basic Authentication From Displaying Prompt For Images"