将HTTPS上的HTTP REFERRER设置为HTTPS站点

时间:2013-01-31 01:11:14

标签: php javascript html .net

有人可以告诉我如何避免http REFERRER网址。我有一个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>

1 个答案:

答案 0 :(得分:1)

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

浏览器发送window对象的location.href。如果您将其更改为其他内容,例如location.href =&#34; http://www.google.com&#34;浏览器将离开您的页面到http://www.google.com

相关问题