Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I want to transfer Javascript array from one page to another.

1. I can not use session as I am using session state as StateServer and it always perform serialization of the session object and array cant be serialized.
2. I can not use Querystring as size of the Querystring can be larger then the supported by various browser.


The scenario is following.

I as trying to Print one page.Whenever this page loads into the browser, I performed some operation on the loaded image using Javascript, during this load of the page I create one JavaScript array for the marking points on the image.

To print that page I have created one .aspx page and I am opening that page using javascript into the Window.open() method.

So all things are same in the new window that is going to be print, but I need marking points that created on the Parent page. As javascript file is loaded again to print the page I have loosed the Javascript array created on the Parent page.

Please let me know if you are unable to understand.

Edited -

The scenario is following.

I as trying to Print one page.Whenever this page loads into the browser, I performed some operation on the loaded image using Javascript, during this load of the page I create one JavaScript array for the marking points on the image.

To print that page I have created one .aspx page and I am opening that page using javascript into the Window.open() method.

So all things are same in the new window that is going to be print, but I need marking points that created on the Parent page. As javascript file is loaded again to print the page I have loosed the Javascript array created on the Parent page.

Please let me know if you still unable to understand.



Thanks
Anil Indorkar
Posted
Updated 30-Aug-11 7:11am
v3
Comments
BobJanova 30-Aug-11 11:52am    
Sounds like what you are trying to do is a bit weird, and maybe you don't need to do it. Can you describe your use scenario a bit more? (using Improve Question so other people seeing the question will see it). You should not generally have very large data sets in the client (i.e. in Javascript).
RaisKazi 30-Aug-11 13:14pm    
Please don't add further details of Question as a Answer/Solution, I have updated Question with the details you added as an Answer.

1 solution

Hope this may help you out...

Web-page 1 (Main page or parent page) :
- create one global JavaScript variable, for example - imgMarkers, which will store the marking points.
- in the URL that is passed as argument in window.open() method, add one more flag indicating that its a call from parent page (say for example - isCalledFromParent)

Web-page 2 (Child page) :
- check for the existence of isCalledFromParent using the request object or simple JavaScript URL parsing.
- if variable found, means that the parent window does contain the required marker points array.
- fetch the values of the array using following piece of code
JavaScript
var markerPointsArr = window.opener.imgMarkers;

- Proceed further as required.

Thanks & Regards,
Niral Soni
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900