0

有人可以告诉我如何避免 http REFERRER url。我有一个 html 表单,我想使用 Javascript 发布表单。是否可以将 REFERRER url 设置为 NULL。这是代码,请让我知道这是否可能,或者您有任何替代方案感谢您的帮助

<!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>
4

1 回答 1

1

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

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

于 2013-01-31T01:22:48.980 回答