M
multicherry
Hi,
Having searched for a way to fetch a window object by name, all I came
across were answers along the line of...
"All you have to do is say windowObj = window.open("blah", "name");"
which isn't very useful if you want to fetch information from an
existing document in the window.
One solution I came up with was quite simple; open the "new" window,
giving you a reference to the object, then use window.history.back() to
force display of the previous contents. This isn't a perfect solution,
as it has the same effect as replacing the document, then clicking the
back button; but it seems to work.
The basic code required is given below. However, for those who are
interested, I've set up a working demonstration at
http://www.multicherry.com/windowbyname
*** FUNCTION:-
function get_window_object_by_name(nameStr)
{
var result = window.open('goback.htm', nameStr);
return result;
}
*** REQUIRED HTML DOCUMENT "goback.htm":-
.....<body>
<script lang="javascript" type="text/javascript">
window.history.back();
</script>
</body>....
Any thoughts?
- MCh
(This message posted to the public comp.lang.javascript Usenet
newsgroup via Google Groups. I am not associated with, nor a member of
any website/discussion-board which repackages and misrepresents such
discussions as belonging to themselves.)
Having searched for a way to fetch a window object by name, all I came
across were answers along the line of...
"All you have to do is say windowObj = window.open("blah", "name");"
which isn't very useful if you want to fetch information from an
existing document in the window.
One solution I came up with was quite simple; open the "new" window,
giving you a reference to the object, then use window.history.back() to
force display of the previous contents. This isn't a perfect solution,
as it has the same effect as replacing the document, then clicking the
back button; but it seems to work.
The basic code required is given below. However, for those who are
interested, I've set up a working demonstration at
http://www.multicherry.com/windowbyname
*** FUNCTION:-
function get_window_object_by_name(nameStr)
{
var result = window.open('goback.htm', nameStr);
return result;
}
*** REQUIRED HTML DOCUMENT "goback.htm":-
.....<body>
<script lang="javascript" type="text/javascript">
window.history.back();
</script>
</body>....
Any thoughts?
- MCh
(This message posted to the public comp.lang.javascript Usenet
newsgroup via Google Groups. I am not associated with, nor a member of
any website/discussion-board which repackages and misrepresents such
discussions as belonging to themselves.)