Advertisement Jump to content
Sign in to follow this  

[web] passing variables to subwindows in js

This topic is 4952 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.) ...,"",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
I'm not sure exactly what showModalDialog does in IE, but anyway - I don't know whether the window object you get back from, 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.


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's and it doesn't have a title argument. Otherwise it's about the same as

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!