简体   繁体   English

如何在 JavaScript 中访问网页的 HTTP 请求标头?

[英]How can i accessing the web page's HTTP request Headers in JavaScript?

I have one IOS application and pass token in request header while open my webview.我有一个 IOS 应用程序并在打开我的 web 视图时在请求标头中传递令牌。 I want this request header token while my site load.在我的网站加载时,我想要这个请求标头令牌。

Request headers used to load the HTML document the JS is running inside are not exposed to that JS.用于加载 JS 在其中运行的 HTML 文档的请求标头不会暴露给该 JS。

You'll need to get the data some other way (such as having the server echo the data back in data-* attribute or passing it in from outside the webview).您需要以其他方式获取数据(例如让服务器在data-*属性中回显数据或从 webview 外部传递数据)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM