3

I am running IE 9. Up until last week sometime, if I would put the URL of a JavaScript file in the address bar, it would show the JavaScript as text in the browser window. Now when I do that, it wants to download the JavaScript file.

How can I revert it to the previous handling?

This is annoying since I'm developing a web application and if I can get it to display the .js files as text in the browser, then I can refresh it to force the cache to update.

Update: I've tested on several co-workers machines. For some, browsing to .js files renders them in the browser (IE 9 in all cases). In others, it asks for a download. File associations don't seem to have any effect. One co-worker we tested with IE and Chrome. IE wanted to download it, but Chrome rendered it as text. This makes me think it's an IE issue and not an OS issue.

9
  • Perhaps if you shared the URL we could give a better answer? Dec 17, 2012 at 21:04
  • The Javascript file is on my machine. I do web development. Here's the URL: localhost/georgescript.js I don't think that's going to help you solve my problem, though.
    – Pete
    Dec 17, 2012 at 21:15
  • Actually it does help slightly - it does tell me you are running a local web server. Doesn't look like it works in IE10 either. In fact, you end up with about 5 or 6 clicks before you get anywhere. Though that was from a random web page on the web. It's not an answer but I'd choose a more developer friendly browser!! ;) Dec 17, 2012 at 21:45
  • I am running a local web server but as far as the problem is concerned, it doesn't matter if I choose a localhost javascript file or a javascript file from any external web site. The problem is the same.
    – Pete
    Dec 17, 2012 at 22:15
  • 1
    @Karan, that link gave me the answer. I simply added a key in the MIME content type database for application/x-javascript (there wasn't one, not sure if there should be or not) and set the CLSID string to "{25336920-03F9-11cf-8FD0-00AA00686F13}" which says it's an HTML document, restarted my browser, and it worked (Javascript still appears to execute fine on web pages as well). If you'll post that as an answer, I'll check it off. Thanks!
    – Pete
    Dec 18, 2012 at 13:54

2 Answers 2

3

Try adding an entry for JS files to the MIME type database in the registry via the following .REG file (courtesy Cheeso's answer here):

Windows Registry Editor Version 5.00
;
; Tell IE to open JS documents in the browser.
; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place".
;

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/x-javascript]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/javascript]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
2
  • Tried this, didn't work for me (though I'm using IE11). It prompts me to Run or Download the .js file. IE is still an unbelievable pile of crap.
    – Jez
    Jan 15, 2015 at 9:54
  • This works for me using IE11. Have just edited the answer to include another javascript type. If IE does report any other different file/type, just add as required. Nov 11, 2015 at 12:04
-1

If you are really just trying to manually recache the js file, you could just go to the page using the script file and press CTRL + F5 to empty the cache and redownload all files from that site.

If I go to a Javascript in IE 9 it'll ask me where to save the file.

4
  • Well, in addition to being able to refresh, it's simply handy for me to see what version of the .JS it's using. Yes, I can F12 it, but I can also F12 to refresh the .js. What I want is to fix it back to the way it was because that was the most effecient way for me to work.
    – Pete
    Dec 17, 2012 at 21:13
  • Well, I have to agree with Julian Knight, commenting on the question. I'd rather go with a more developer-friendly browser such as Google Chrome or Mozilla Firefox. It sounds as if this was done by an update to IE in general, seeing IE 10 does the same as 9. Microsoft is trying hard to turn the developers to IE, but it's not working. Their functionality is severely limited. By the way, you can do exactly the thing you are talking about in Firefox, not sure about Chrome. Dec 17, 2012 at 21:57
  • Unfortunately we develop for IE only as it's the company's choice of browser (certainly not mine). And this is not an update/version issue (see my update. We compared version numbers and revisions).
    – Pete
    Dec 17, 2012 at 22:12
  • Yes, exactly. I too, was trying to open a .js file in IE 9 resulting in a downloaded javascript. This is an interesting issue, but I'm out of ideas then. Dec 17, 2012 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .