“ window.open”使用“ _self”参数时如何将变量传递到新窗口?

问题描述

下面的代码自我解释了这个问题:

go_to("test.html")             //open "test.html" in new tab,and "y" var is set to "xxx" (as expected)

go_to("test.html","_self")    //open "test.html" in same tab,but issues below occur:
//Firefox 61.0.2,"y" var is not set to "xxx" in "test.html",but it is set in the prevIoUs page!
//Opera 71.0.3770.284,"y" var is not set to "xxx" neither in "test.html" nor in the prevIoUs page!

function go_to(url,option){

x = "xxx";

var window_ref = window.open(url,option);
  
window_ref.y = x;        //pass the "x" variable of the current window to the "y" variable of the new open window!

}

有关如何解决此问题的任何建议?谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)