问题描述
我正在研究一个示例项目,并试图在IE中查看引荐来源网址。下面是我尝试的代码。有什么建议吗?
<html>
<head>
<title>First Web Application</title>
</head>
<body>
<span style="color: #ff0000; ">${errorMessage}</span>
<form method="post">
Name : <input type="text" name="name" />
Password : <input type="password" name="password" />
<input type="submit" />
</form>
<%--
<button title="Link that opens in a new window" onclick="window.location.href='https://localhost:8082/welcome-get?token=ghgshshdg'">Next</button>
--%>
<a title="Link that opens in a new window" onclick="window.open(this.href,'this.name');return false;" referrerpolicy="origin" href="https://localhost:8082/welcome-get?token=st566565">Next</a>
</body>
</html>
解决方法
有official document可以解决与引荐来源相关的问题,但此问题看起来有些不同。在将Referer从HTTPS传递到HTTPS时,我也可以看到该问题。在其他浏览器中,引荐来源可以正常运行。
我使用IE 11浏览器进行了一些测试,并试图缩小问题的范围。
我在您的代码中发现您正在尝试在新窗口中打开网页并获取空引用。我站在一边的结果也一样。
我建议您尽可能删除 OnClick 事件并尝试添加target="_blank"
,这将帮助您在新标签页/窗口中打开页面,并且还会传递引荐来源网址
示例代码:
<a title="Link" referrerpolicy="origin" href="https://Your_URL_here..." target="_blank">Next1</a>
在IE 11浏览器中的输出: