window.open和a标签界面跳转403解决方案

问题描述:window.open跳转窗口显示403,直接输入地址回车则可以正常跳转

解决方案一:

a标签跳转的话添加“ referrerpolicy=“no-referrer” ”即可

<a href="https://dsadsa" referrerpolicy="no-referrer">点击跳转</a>

解决方案二:window.open跳转

window.open(url, '_blank', 'noopener=yes,noreferrer=yes')

解决方案三:也可在要跳转的项目index.html中添加

<meta name="referrer" content="no-referrer" />

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<!-- 添加 referrerpolicy="no-referrer"-->
	<a href="https://www.jszhdc.cn/jsdz/toLogin.do" referrerpolicy="no-referrer">点击跳转</a>
	<script>
		setTimeout(function() {
			// <!-- 加'_blank'-->
		    window.open('https://www.jszhdc.cn/jsdz/toLogin.do', '_blank')
		}, 1000);
	</script>
	<button onclick="toUrl()">点击</button>
</body>
</html>