Reading browser's Accept header in Javascript
Asked Answered
L

0

7

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?

Laboured answered 12/8, 2016 at 17:5 Comment(5)
Take a look at this question, it might suite your needs: #220731Whet
This 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.Laboured
Also 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' ThanksUllage
@DavidPears, have you found a solution for this? I have the same issue because of 3dSecure version 2.0 as well.Diapason
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.Compton

© 2022 - 2024 — McMap. All rights reserved.