I have a TestMain.htm page that has following javascript:
var pswin;
function openWindow(url)
{
var features;
features = "resizable";
if (!pswin || pswin.closed)
pswin = window.open(url, "presentationWindow", features);
else
pswin.location.href = url;
if (window.focus && pswin != null)
pswin.focus();
}
inside body, I have 4 buttons:
<input type="button" value="Test1"
onclick="javascript:openWindow('test1.htm');">
<br>
<input type="button" value="Test2"
onclick="javascript:openWindow('test2.htm');">
<br>
<input type="button" value="ppt 1"
onclick="javascript:openWindow('slide1.ppt');">
<br>
<input type="button" value="ppt 2"
onclick="javascript:openWindow('slide2.ppt');">
It works perfect if I just click on the Test1 and Test2 - pure html page -
no error at all and the newly created window alway got focus;
but if I click on "ppt 1" or "ppt 2" then click another button, I got error
"member not found" on line pswin.focus();
I searched on google and it seems lots of people has the same issue - it
works with pure html, but when you load something like powerpoint slide,
word doc, pdf, ... the .focus() by some reason not available anymore.
I tested to close the original window and reopen it and it works - BUT I
cannot open the existing window and I need the newly opened window stay on
the second monitor all the time.
Thanks!
John
add the two lines below:
var pswin;
function openWindow(url)
{
var features;
features = "resizable";
//////////////////////////////////////////////////////////////////////////////////////////////////
// Grab it with blank url (""), close it....
pswin = window.open("", "presentationWindow",features);
pswin.close();
// Re-open it with url and set focus to it...
//////////////////////////////////////////////////////////////////////////////////////////////////
if (!pswin || pswin.closed)
pswin = window.open(url, "presentationWindow", features);
else
pswin.location.href = url;
pswin.focus();
}
cheers,
Michael.