Reputation: 313
Please take a look at this url :
https://lh6.ggpht.com/uxLXvxuncWOm2mgU3ChtdGZ0eMp_WJTD4xrVxAKqCJMiR5ibaBbw-VUPJPjcGiqIDRbm=h310
This link refers to an screenshot of Facebook app on google play.
As you can see, The mime-type for this link is document.
What's this image's real extension ?
Actually, I have a list of +10k screenshots and I want to download them to my local hard disk with exactly the same name as the image url. But I don't know how . (I could do it easily if there was a known image mime-type on these links, But now that mime-type is document, And files don't have an extension , I don't know how )
Upvotes: 1
Views: 2039
Reputation: 5525
The mime-type returned by the server is not document
, it is actually image/png
.
You can get the mime-type returned by the server with code like this:
var request = new XMLHttpRequest();
request.open("GET", "https://lh6.ggpht.com/uxLXvxuncWOm2mgU3ChtdGZ0eMp_WJTD4xrVxAKqCJMiR5ibaBbw-VUPJPjcGiqIDRbm=h310");
request.addEventListener("load", function () {
var type = this.getResponseHeader("Content-Type");
console.log(type);
});
request.send();
Upvotes: 1