Buddies,With IE, we can return a value from an opened child window to the parent window (opener) using the statementreturn window.returnValue;My
question, how can I use the same javascript methodology in non-IE browser like FireFox? FireFox does not support window.returnValue so which is the solution in FireFox?I
do not want to use a workaround for FireFoxto set the returned value like:window.opener.document.getElementById(‘myTargetObjectInOpener’).value=
document.getElementById(‘myReturnedValueInOpenedWindow’).value;
I understand that ‘returnValue’ is only available when creating a window using ‘showModalDialog’? I don't think showModalDialog is supported by FF, in which case you’ll need to adopt a different approach.
I use the method you describe as a ‘workaround’, which is the standard DOM method, I believe.
Paul,
I have a scenario like this: a main browser window has a button named "Fill". When that button is hit, a popup window page is opened with js script like window.open(...) and a user could pick a value from many ones on that popup window.
The popup window also has a button named "OK" so the user after picking any value, he can hit that button and the button's click handler should return that value back to a textbox on the opening browser window. That is all I want. I know window.returnValue
is just works for IE. However, I prefer the same thing that would work for FireFox. Is that possible for FF?
Sorry to disturb the thread ..I have a similar situation to the one described above of your situation ..I am posting this with a hope you could guide me to get a solution or atleast post your code so that i can try myself .my question is on the following
link http://forums.asp.net/t/1303687.aspx
Cheers
Paladinckm
One Who distributes his knowledge is Scholar
Since there is no window.returnValue variable in Firefox, your ONLY recourse is to do something like:
window.opener.document.getElementById('someTargetObjectInOpener').value = 'value-to-return';
If it ain't there, you can't use it (or create it).
johnaspnet
Member
159 Points
306 Posts
how to simulate window.returnValue in non-IE browser like FireFox
Jul 30, 2007 03:52 PM|LINK
Thanks in advance.
bpw
Contributor
2258 Points
490 Posts
Re: how to simulate window.returnValue in non-IE browser like FireFox
Jul 30, 2007 04:34 PM|LINK
I understand that ‘returnValue’ is only available when creating a window using ‘showModalDialog’? I don't think showModalDialog is supported by FF, in which case you’ll need to adopt a different approach.
I use the method you describe as a ‘workaround’, which is the standard DOM method, I believe.
johnaspnet
Member
159 Points
306 Posts
Re: how to simulate window.returnValue in non-IE browser like FireFox
Jul 30, 2007 08:13 PM|LINK
Paul,
I have a scenario like this: a main browser window has a button named "Fill". When that button is hit, a popup window page is opened with js script like window.open(...) and a user could pick a value from many ones on that popup window.
The popup window also has a button named "OK" so the user after picking any value, he can hit that button and the button's click handler should return that value back to a textbox on the opening browser window. That is all I want. I know window.returnValue is just works for IE. However, I prefer the same thing that would work for FireFox. Is that possible for FF?
bpw
Contributor
2258 Points
490 Posts
Re: how to simulate window.returnValue in non-IE browser like FireFox
Jul 30, 2007 08:50 PM|LINK
'returnValue' is only supported in IE4+. The way to do it is as follows:
window.opener.document.getElementById("TextBox1").value = document.getElementById("DropDownList1").value;
If you’re doing a lot of work with the child window, you can shorten the statement slightly as follows:
var parentDoc = window.opener.document;
parentDoc.getElementById("TextBox1").value = document.getElementById("DropDownList1").value;
These examples assume your user is selecting a value from a DropDownList, but the principle is the same however the selection is made.
paladinckm
Member
262 Points
258 Posts
Re: how to simulate window.returnValue in non-IE browser like FireFox
Aug 11, 2008 04:12 PM|LINK
Hi ,
Sorry to disturb the thread ..I have a similar situation to the one described above of your situation ..I am posting this with a hope you could guide me to get a solution or atleast post your code so that i can try myself .my question is on the following link http://forums.asp.net/t/1303687.aspx
Paladinckm
One Who distributes his knowledge is Scholar
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: how to simulate window.returnValue in non-IE browser like FireFox
Aug 11, 2008 04:42 PM|LINK
Since there is no window.returnValue variable in Firefox, your ONLY recourse is to do something like:
window.opener.document.getElementById('someTargetObjectInOpener').value = 'value-to-return';
If it ain't there, you can't use it (or create it).
NC...
bhanu_pratap
Member
4 Points
3 Posts
Re: how to simulate window.returnValue in non-IE browser like FireFox
Jun 25, 2010 02:33 PM|LINK
Hi all
window.ReturnValue is working fine in FireFox(I am using 3.6.3) but its not working in Chrome .
If any one have any solutions then plese reply .this is kind of urgent..
window.returnValue