admin管理员组文章数量:1389754
I have any array called query[]
I am opening a new window with:
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.
EDIT: I just found this, Pass array to Window which will probably provide the answer.
EDIT2: the answer provided in question 2487420 doesn't seem to work, I am using FireFox and openDialog never opens a new window
New Requirement: This only has to work on FireFox because I am only using it for testing.
I have any array called query[]
I am opening a new window with:
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.
EDIT: I just found this, Pass array to Window which will probably provide the answer.
EDIT2: the answer provided in question 2487420 doesn't seem to work, I am using FireFox and openDialog never opens a new window
New Requirement: This only has to work on FireFox because I am only using it for testing.
Share Improve this question edited May 23, 2017 at 12:29 CommunityBot 11 silver badge asked May 1, 2011 at 12:27 AnkurAnkur 51.2k114 gold badges248 silver badges316 bronze badges 1- what does the array contain? If it's simple items (e.g. numbers) see my answer. – user447356 Commented May 1, 2011 at 12:41
2 Answers
Reset to default 3You 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;
to get access to it.
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.
You can also pass it on the URL as well, for example:
window.open("http://localhost:8081/myapp/Query.action?arr=" + query.join(","), "mywindow", ...
This will pass it as ma separated list that can be read in the target page.
本文标签: javascriptHow do I pass any array to a window being opened with windowopen()Stack Overflow
版权声明:本文标题:javascript - How do I pass any array to a window being opened with window.open() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744663403a2618385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论