How do I pass any array to a window being opened with window.open()

前端 未结 2 990
终归单人心
终归单人心 2021-01-28 22:54

I have any array called query[]

I am opening a new window with:

  window.open(\"http://localhost:8081/myapp/Query.action\",\"mywindow\",\"me         


        
2条回答
  •  余生分开走
    2021-01-28 23:31

    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;
    

    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.

提交回复
热议问题