简体   繁体   English

重定向后window.opener丢失

[英]window.opener lost after redirect

The situation is as follows: I have a main window which opens a child window using window.open(). 情况如下:我有一个主窗口,该主窗口使用window.open()打开一个子窗口。 Then there are couple of forwards (it's Struts 1) because this is a multi-step wizard and the user can select multiple options in each step. 然后是几个前进指令(它是Struts 1),因为这是一个多步骤向导,用户可以在每个步骤中选择多个选项。

The problem is however that the window.opener is undefined in the last step of the wizard and I want to set a hidden filed in the parent page to some value(the page which actually created the window in which the wizard is happening). 但是问题是,在向导的最后一步中未定义window.opener,我想将父页面中的隐藏文件设置为某个值(该页面实际上创建了发生向导的窗口)。 Window.opener is lost after going to the second step of the wizard. 转到向导的第二步后,Window.opener丢失。

Thanks for any suggestions. 感谢您的任何建议。

If all you need is a specific value from the opener, get that on the first load of the window and store it in a hidden field - keep storing in hidden fields for all wizard steps and you will have the required value on the last wizard page. 如果您需要的只是打开器中的特定值,请在窗口的第一次加载时获取该值并将其存储在隐藏字段中-继续将所有向导步骤存储在隐藏字段中,您将在最后一个向导页面上获得所需的值。

Unfortunately, as the child window changes, you cannot retain information about the opener, as you discovered. 不幸的是,随着子窗口的更改,您将无法保留有关打开器的信息,正如您发现的那样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM