Why does if(win==null || win.closed) return true after one PDF is open.
Something very wierd going on with IE 6. I also get a member not
found error if a child window is already open. This script works fine
if the child window contains HTML, just not a PDF. Ideas? Note: These
are not my PDFs, I just found some on the Net so you could test.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitl ed Document</title>
<script type="text/javascript">
var win;
function winfocus(){
if(!(win==null || win.closed))
win.focus();
}
function newWindow(myurl ,mywidth,myheig ht,resize){
var myDate=new Date();
var myTime=myDate.g etTime();
var URL=((myurl.ind exOf('?') -1))?myurl + '&time=' + myTime:myurl +
'?time=' + myTime;
var w=mywidth;
var h=myheight;
var winname='popWin dow';
var winl = (screen.width - w) / 2, wint = (screen.height - h) / 2;
var
winresize=((res ize=='resize')) ?'scrollbars=ye s,resizable=yes ':'scrollbars=n o,resizable=no' ;
var winprops = 'height='+h+',w idth='+w+',top= '+wint+',left=' +winl +
',toolbar=no,st atus=no,menubar =no,' + winresize;
if(win==null || win.closed)
win=window.open (URL, winname, winprops);
win.focus();
document.onclic k=winfocus;
}
</script>
</head>
<p><a href="http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf"
onclick="newWin dow('http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf',5 00,400,'resize' );return
false"></a></p>
<p><a href="http://grants.nih.gov/grants/funding/phs398/biosketch.pdf"
onclick="newWin dow('http://grants.nih.gov/grants/funding/phs398/biosketch.pdf', 500,400,'resize ');return
false"></a></p>
<body>
</body>
</html>
Something very wierd going on with IE 6. I also get a member not
found error if a child window is already open. This script works fine
if the child window contains HTML, just not a PDF. Ideas? Note: These
are not my PDFs, I just found some on the Net so you could test.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitl ed Document</title>
<script type="text/javascript">
var win;
function winfocus(){
if(!(win==null || win.closed))
win.focus();
}
function newWindow(myurl ,mywidth,myheig ht,resize){
var myDate=new Date();
var myTime=myDate.g etTime();
var URL=((myurl.ind exOf('?') -1))?myurl + '&time=' + myTime:myurl +
'?time=' + myTime;
var w=mywidth;
var h=myheight;
var winname='popWin dow';
var winl = (screen.width - w) / 2, wint = (screen.height - h) / 2;
var
winresize=((res ize=='resize')) ?'scrollbars=ye s,resizable=yes ':'scrollbars=n o,resizable=no' ;
var winprops = 'height='+h+',w idth='+w+',top= '+wint+',left=' +winl +
',toolbar=no,st atus=no,menubar =no,' + winresize;
if(win==null || win.closed)
win=window.open (URL, winname, winprops);
win.focus();
document.onclic k=winfocus;
}
</script>
</head>
<p><a href="http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf"
onclick="newWin dow('http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf',5 00,400,'resize' );return
false"></a></p>
<p><a href="http://grants.nih.gov/grants/funding/phs398/biosketch.pdf"
onclick="newWin dow('http://grants.nih.gov/grants/funding/phs398/biosketch.pdf', 500,400,'resize ');return
false"></a></p>
<body>
</body>
</html>
Comment