Jump to content
  • Advertisement
Sign in to follow this  

[web] passing variables to subwindows in js

This topic is 4712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to write a function to emulate showModalDialog (with a modeless dialog) on non-IE browsers.
function xShowModelessDialog(sUrl, vArguments, sFeatures)
{
  // ... (parsing sFeatures etc.) ...

  modalWin=window.open(String(sURL),"",sMyFeatures);
  modalWin.dialogArguments = vArguments;
]
But the new window cannot find a member called 'dialogArguments'. What am I doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure exactly what showModalDialog does in IE, but anyway - I don't know whether the window object you get back from window.open, is cleared out before the page loads. It may be.

Perhaps you should prefer window.opener.variablename, from the popup window. It's certainly safer.

Normally the browser clears out the window object (possibly creates a whole new one) every time the page content changes (i.e. via a new URL). It may be that this happens immediately in a new window, thus defeating your attempts to pass it parameters.

If the windows are both from the same site, you can use window.opener to retrieve the parameters from the parent - this will be safer.

Mark

Share this post


Link to post
Share on other sites
showModalDialog creates a window that is always on top and sets its dialogArguments property to the second argument, which I'm attempting to do. Its third features argument is incompatible with window.open()'s and it doesn't have a title argument. Otherwise it's about the same as window.open().

I was hoping to create such a function that existing code could work without modifications.

EDIT: According to this it should work. Do I need to predeclare dialogArguments somehow?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!