How to change browser User-Agent Header with javaScript?

后端 未结 2 461
说谎
说谎 2021-01-24 00:20

Following code changes property printed (when accessed through javaScript) by browser console and not the actual Use-Agent string sent with the header.

Object.de         


        
相关标签:
2条回答
  • 2021-01-24 00:27

    This is now possible to do, see: https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name You can use ‘ XMLHttpRequest.setRequestHeader(User-Agent, value)’

    0 讨论(0)
  • 2021-01-24 00:39

    This isn't possible from the page itself. The user agent string (as sent in the HTTP request headers) can only be changed via browser extension or browser configuration.

    0 讨论(0)
提交回复
热议问题