将 HTTPS 上的 HTTP 引荐来源网址设置为 HTTPS 站点


Set HTTP REFERRER on HTTPS to HTTPS site

有人可以告诉我如何避免http REFERRER url。我有一个html表单,我想使用Javascript发布表单。是否可以将引荐来源网址设置为空。这是代码,请让我知道这是否可能,或者您有其他选择感谢您的帮助

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
document.write('<form id="l" method="post" action="https://www.test.com">');
document.write('<input type="hidden" id="e" name="email">');
document.write('<input type="hidden" name="pass" id="p"></form>');
function g(x){
  return document.getElementById(x);
}
g('e').value='username';
g('p').value="password";
g('l').submit();
</script>
</body>
</html>

Referer 标头是浏览器发送到服务器的内容。您无法更改它,因为浏览器不提供 javascript API 来更改它。

浏览器发送窗口对象的 location.href。如果您将其更改为其他内容,例如 location.href = "http://www.google.com",浏览器将从您的页面导航到 http://www.google.com