问题描述
我有一个名为query[]
我要打开一个新窗口:
window.open("http://localhost:8081/myapp/Query.action","mywindow","menubar=1,resizable=1,width=600,height=400");
如何将该数组传递到新窗口,以便在那里使用它.
How do I pass this array to the new window so I can use it there.
我刚刚找到了这个将数组传递给Window ,这可能会提供答案
I just found this, Pass array to Window which will probably provide the answer.
问题2487420中提供的答案似乎无效,我使用的是FireFox,而openDialog从未打开新窗口
the answer provided in question 2487420 doesn't seem to work, I am using FireFox and openDialog never opens a new window
新要求:这仅适用于FireFox,因为我仅将其用于测试.
New Requirement: This only has to work on FireFox because I am only using it for testing.
推荐答案
您不能传递"数组,但是可以将其作为全局变量(或通过全局变量)使用,并且新页面可以使用某些东西像:
You can't "pass" the array, but you can make it available as a global (or via a global), and your new page can use something like:
var theArray = window.opener.theArray;
访问它.
或者,您可以 将数组作为参数列表传递,但是如果服务器对它不感兴趣,那么这会有些浪费.
Alternatively, you could pass the array through as a list of parameters, but if it's not otherwise interesting to the server then that would be a little wasteful.
这篇关于如何将任何数组传递给使用window.open()打开的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!