<html>
<head>
<script type="text/javascript">
alert("refresh");
</script>
</head>
<body>
<a onclick="javascript:window.open('b.html');">OpenNewWindow</a>
<body>
</html>
<html>
<head>
</head>
<body onUnload="javascript:opener.location.href='a.html';">
<a onclick="javascript:window.close(this)">[CloseWindow]</a>
</body>
</html>
方法二
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="btn">按钮</div>
<script>
var btn=document.getElementById("btn");
btn.onclick=function () {
// window.location.href="http://localhost:63342/easyui-demo/easyui-demo/table/本地2.html";
var info={
as:1,
aw:'2'
}
localStorage.setItem('key',JSON.stringify(info));
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
window.addEventListener("storage",function () {
var jsonData=JSON.parse(localStorage.getItem("key"));
if (jsonData.mag){
ajax()//可以刷新其他页面的ajax
}
})
</script>
</body>
</html>