js——在A页面打开新页面B,关闭新页面B后刷新A页面

时间:2024-03-13 21:05:48

参考:https://www.runoob.com/w3cnote/js-refresh-current-page.html

 

我的情况: vue页面(A)下打开一个html页面(B),在html页面上操作完成后,关闭html页面并刷新vue页面

 

A页面:

function toPageB(url){           
   sessionStorage.setItem(\'currentPath\',window.location.href); //用于关闭B后刷新A页面 window.open(url, \'_blank\'); }

 

 

B页面:

function reloadPageA(){
   var currentPath = sessionStorage.getItem(\'currentPath\');
   window.location.replace(currentPath);  //载入新文档替换当前页面
}