Resource interpreted as Script but transferred with MIME type text/plain – for local file

I figured it out! The Visual Studio installer must have added an errant line to the registry. open up regedit and take a look at this registry key: See that key? The Content Type key? change its value from text/plain to text/javascript. Finally chrome can breathe easy again. I should note that neither Content Type … Read more

Which MIME type to use for a binary file that’s specific to my program?

I’d recommend application/octet-stream as RFC2046 says “The “octet-stream” subtype is used to indicate that a body contains arbitrary binary data” and “The recommended action for an implementation that receives an “application/octet-stream” entity is to simply offer to put the data in a file[…]”. I think that way you will get better handling from arbitrary programs, … Read more

image.onError event never fires, but image isn’t valid data – need a work around

In the image.onload event listener, check whether image.width and image.height are both zero (preferably image.naturalWidth and image.naturalHeight, when they are supported). If the width and height are both zero, the image is considered invalid. Demo: http://jsfiddle.net/RbNeG/ // Usage: loadImage(‘notexist.png’); function loadImage(src) { var image = new Image; image.onload = function() { if (‘naturalHeight’ in this) … Read more