While it's possible to get the browser's User-Agent in Javascript via navigator.userAgent
, is it likewise possible to get the browser's Accept
header without performing a HTTP request?
Asked
Active
Viewed 6,018 times
7

Matt Borja
- 1,509
- 1
- 17
- 38
-
Take a look at this question, it might suite your needs: http://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript – Miloš Đakonović Aug 12 '16 at 17:13
-
2This is not really about parsing an incoming response. I'm trying to see if it's possible to access it as a *property of the browser* per the `navigator.userAgent` example. On the server-side, it would come through as the *request* header `HTTP_ACCEPT`. It's not looking good (as in possible) anyways and doesn't fit the original application I was going to use it for so this may be a closed door at this point. – Matt Borja Aug 12 '16 at 17:38
-
11Also looking for this information - as new banking 3dSecure (2021) is requesting we send BrowserInfo (incl. acceptHeader info). I see this is 4 years+ old - but if anyone stumbles across this, I'd love to hear if there is a simple way to access it as OP states - i.e similar to accessing 'navigator.userAgent' Thanks – David Pears Apr 06 '21 at 08:57
-
3@DavidPears, have you found a solution for this? I have the same issue because of 3dSecure version 2.0 as well. – duduklein Nov 18 '21 at 16:51
-
Anyone every figure this out? I want to get the browers default value for its `Accept` header from JavaScript. I need to make an AJAX fetch request using the exact `Accept` header that the browser usually sends by default when it requests a webpage. – RcoderNY Oct 06 '22 at 18:02