Html 将 http 请求头添加到 aa href 链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15835783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding http request header to a a href link
提问by More Than Five
I have a simple href
link from some html
我有一个href
来自一些的简单链接html
<a href="www.google.com">Apparently you can find things here</a>
But I want to add a http request header to the request?
但是我想在请求中添加一个http请求头?
Is this possible.
这可能吗。
回答by Quentin
There is no way for a page to specify HTTP request headers other than for requests made using XMLHttpRequest and fetch.
除了使用 XMLHttpRequest 和 fetch 发出的请求之外,页面无法指定 HTTP 请求标头。
回答by Dogoferis
Can you elaborate on what you are trying to do?
你能详细说明你想要做什么吗?
I don't believe it's possible to specify a request header via a link. You can send GET parameters to the target site with the following notation:
我不相信通过链接指定请求头是可能的。您可以使用以下符号将 GET 参数发送到目标站点:
www.google.com?q=searchterm
The first GET parameter is separated from the URL by a question mark (?) after that each additional parameter should be separated with an ampersand (&) like so:
第一个 GET 参数用问号 (?) 与 URL 分开,之后每个附加参数都应该用与号 (&) 分开,如下所示:
www.google.com?q=searchterm&otherparam=value&otherotherparam=value