Current location: Hot Scripts Forums » General Web Coding » JavaScript » how to pass a large info to a page via window.open


how to pass a large info to a page via window.open

Reply
  #1 (permalink)  
Old 08-11-04, 07:04 AM
jasongr jasongr is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
how to pass a large info to a page via window.open

Hello

I would like to open a new window using window.open()
I need to be able to pass a large serialized object to that object. The serialized content is generated by PHP.
The serialized object is represented as a long string that I would like to pass to the new window.
It cannot be part of the URL, since the string can be very long (more than 255 characters).
Is there a way to pass such info to the window?

I am using IE 5.5

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-11-04, 08:16 AM
uprightdog uprightdog is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
You could put your string into a hidden form field and submit it to a new window. Or alternatively you could store the string in a session variable or a DB and retrieve it from your new window.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 08-12-04, 12:39 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
You could do like this:

myWin = window.open()

myWin.myString = "The object string goes here"

or like this in the new window after it's been opened:

alert(window.opener.myString)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 08-12-04, 01:04 AM
jasongr jasongr is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
what is the "myString" that you mention?
Is it a global JavaScript variable that should be defined inside the new page?
If so, will it get the value before the new page will be opened, and then when the new page renders itself, this variable will be available in the page?

Jason
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 08-12-04, 06:14 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
In the first example, myString becomes a global variable in the child window.
The variable can be accessed in the child window like any other global variable on that page.

In the second example we access a global variable in the parent window from the child window using the "window.opener" object.

If you want to read/write/create a global variable in another window you just give a reference to it like "window.opener. or myWin." and your variable name.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 03:22 AM
pass variables to a .php page within a page davidcsi PHP 2 04-21-04 08:34 PM
page browsing problem mivec PHP 3 04-17-04 04:43 AM
i need to pass value of one page to another but using only javascript traceMe JavaScript 2 12-30-03 04:55 AM
Classified Ads skipper23 Perl 2 12-30-03 04:43 AM


All times are GMT -5. The time now is 01:39 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.