In order to conserve server resources I’m looking for a way to retrieve the content type of a given url using javascript. It should not download the complete content from the url only the headers. Is this possible with the restrictions javascript has. Answer Make an Ajax call with a head request.
Tag: content-type
Is it necessary to set a Content-Type in Node.js?
Just started playing with Node.js and after seeing a few examples I see that usually the Content-Type is set before returning some content. Usually something like this for HTML: For image: I read the docs for .write() and it says if no header is specified “it will switch to implicit header mode and flush the implicit headers” With some testing
When serving JavaScript files, is it better to use the application/javascript or application/x-javascript
The whole question fits in the title. And to add some context: I’m not asking what is the best according to what the specs are saying, but rather what works the best given the mix of browsers deployed nowadays. Some data points: Google uses text/javascript for the JS used on their home page. Google uses text/javascript on Google Docs. Google