netformx
asked on
How to redirect in page opened by showModalDialog - so that the page will appear in the same window
Hi,
I use showModalDialog(url1 ...)
if in page with url1 I use document.location=url2 - url2 is opened in the different window. How to cause to open in the same window?
I use showModalDialog(url1 ...)
if in page with url1 I use document.location=url2 - url2 is opened in the different window. How to cause to open in the same window?
Use a frameset in the modal
ASKER
thanks
calling showModalDialog works fine, but the problem is that it's good only if url2 was opened by showModalDialog as well.
The question is: in url2 can I know if it was opened by showModalDialog or window.open?
calling showModalDialog works fine, but the problem is that it's good only if url2 was opened by showModalDialog as well.
The question is: in url2 can I know if it was opened by showModalDialog or window.open?
url2 is loaded in modaldialog right?
ASKER
There was mistake in my question (sorry): The question is: in url1 (!!!) can I know if it was opened by showModalDialog or window.open?
url1 is sometimes loaded by using showModalDialog and sometimes by window.open
If I understand correct:
if it's loaded by showModalDialog - it should redirect to url2 by calling showModalDialog , if it's lded by window.open - it redirects by using document.location.
Unless, you can suggest solution that will work (=the page will be displayed in the same window)in both cases , no matter how it was loaded
url1 is sometimes loaded by using showModalDialog and sometimes by window.open
If I understand correct:
if it's loaded by showModalDialog - it should redirect to url2 by calling showModalDialog , if it's lded by window.open - it redirects by using document.location.
Unless, you can suggest solution that will work (=the page will be displayed in the same window)in both cases , no matter how it was loaded
page to open in showmodal
<frameset rows="100%,*">
<frame src="url1.html">
</frameset>
in the page:
if (top.dialogArguments) alert('I am opened by a showmodal')
However since you are now in a frameset, any window.location=url2
will work regardless
<frameset rows="100%,*">
<frame src="url1.html">
</frameset>
in the page:
if (top.dialogArguments) alert('I am opened by a showmodal')
However since you are now in a frameset, any window.location=url2
will work regardless
ASKER
could you, pelase be more specific?
let's give names:
from url0 - I want to open url1 in modal window
from url1 I want to open url2 in the same window
so where do I insert the frameset?
let's give names:
from url0 - I want to open url1 in modal window
from url1 I want to open url2 in the same window
so where do I insert the frameset?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If I put
<frame src="url1.aspx"> - url1 is not displayed. Is it supposed to work with aspx pages?
<frame src="url1.aspx"> - url1 is not displayed. Is it supposed to work with aspx pages?
sure...
How does the rest of the page look?
How does the rest of the page look?
ASKER
I udnerstood what was teh issue with aspx: frameset has to be aspx as well.
but: url1.aspx had GET params (as you said it's a varible: url1.aspx?val=kuku
If so - Have I use your second way? (with dialogArguments) if so, it does not work .... I addd var before loc (since it said that loc is not defined and now frameset is opened but the url1 is not ....)
but: url1.aspx had GET params (as you said it's a varible: url1.aspx?val=kuku
If so - Have I use your second way? (with dialogArguments) if so, it does not work .... I addd var before loc (since it said that loc is not defined and now frameset is opened but the url1 is not ....)
ASKER
the probl;em is that top.dialogArguments.url1 is undefined!!! although I did define it's in url0:
var url1="...";
any idea????
var url1="...";
any idea????
ASKER
I figured out what was the problem - testing it now ....
ASKER
it works fine, thanks!
:)
by
using the showModalDialog with the 2nd url and the same name as the first window!