0

The html source is like this:

<script type="text/javascript" language="JavaScript" src="myscript.js"></script>

However debugging the http request (with Fiddler) it clearly seems that browser (Chrome) issues the GET request for myscript.js with Accept */*.

Is this normal?

Interestingly this issue is not true for CSS files. The browser is correctly asking them Accept: text/css,*/*

(In a programmed proxy server) I would like to detect which requests are for javascript files. I thought I can rely on Accept in request header...

g.pickardou
  • 32,346
  • 36
  • 123
  • 268
  • The MIME type of Javascript files is [somewhat wishy washy.](http://stackoverflow.com/questions/4101394/javascript-mime-type) No real reason for the browser to care about it too much in the request. – deceze Dec 21 '15 at 10:18

1 Answers1

1

Is this normal?

Yes

(In a programmed proxy server) I would like to detect which requests are for javascript files. I thought I can rely on Accept in request header...

You can't. Look at the content-type in the response header instead.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • But why.... :-). Unfortunately I have to decide what to do with the request _before_ I am forwarding it, so I have no response in that time – g.pickardou Dec 21 '15 at 10:20
  • Because browsers never felt the need to handle the possibility that someone might do content type negotiation for a JavaScript resource. – Quentin Dec 21 '15 at 10:23
  • What is the difference of css and js? (this point of view). This is a poetic question no answers need... – g.pickardou Dec 21 '15 at 10:25