Skip to content

Better 404 Handling #3

@mjhasbach

Description

@mjhasbach

Test case:

toDataURL('http://vignette1.wikia.nocookie.net/clubpenguin/images/5/59/Cheese_Pin.png/revision/latest%3Fcb%3D20121229072939', {
    callback: function(err, dataURL) {
        ...
    }
});

CORS will block that request in the browser, but you can use something like cors-anywhere to get around that. The above results in a GET <image> 404 (Not Found), but it appears the host is using mod_rewrite or something similar to provide a placeholder image. I would like to be able to identify cases like that programmatically. It should be possible to refactor to-data-url to use XMLHttpRequest to get image data. That way, you could check the response status code and callback an error on non-2xx responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions