By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,795 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,795 IT Pros & Developers. It's quick & easy.

"Member not found" error when opening PDFs in new window

P: n/a
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>Untitled Document</title>
<script type="text/javascript">
var win;
function winfocus(){
if(!(win==null || win.closed))
win.focus();
}

function newWindow(myurl,mywidth,myheight,resize){
var myDate=new Date();
var myTime=myDate.getTime();
var URL=((myurl.indexOf('?') -1))?myurl + '&time=' + myTime:myurl +
'?time=' + myTime;
var w=mywidth;
var h=myheight;
var winname='popWindow';
var winl = (screen.width - w) / 2, wint = (screen.height - h) / 2;
var
winresize=((resize=='resize'))?'scrollbars=yes,res izable=yes':'scrollbars=no,resizable=no';
var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +
',toolbar=no,status=no,menubar=no,' + winresize;
if(win==null || win.closed)
win=window.open(URL, winname, winprops);
win.focus();
document.onclick=winfocus;
}
</script>
</head>
<p><a href="http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf"
onclick="newWindow('http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf',500,400,'resize');return
false"></a></p>
<p><a href="http://grants.nih.gov/grants/funding/phs398/biosketch.pdf"
onclick="newWindow('http://grants.nih.gov/grants/funding/phs398/biosketch.pdf',500,400,'resize');return
false"></a></p>
<body>
</body>
</html>

Nov 2 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
johkar wrote:
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.
Sorry, here is correct HTML:

<!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>Untitled Document</title>
<script type="text/javascript">
var win;
function winfocus(){
if(!(win==null || win.closed))
win.focus();
}

function newWindow(myurl,mywidth,myheight,resize){
var myDate=new Date();
var myTime=myDate.getTime();
var URL=((myurl.indexOf('?') -1))?myurl + '&time=' + myTime:myurl +
'?time=' + myTime;
var w=mywidth;
var h=myheight;
var winname='popWindow';
var winl = (screen.width - w) / 2, wint = (screen.height - h) / 2;
var
winresize=((resize=='resize'))?'scrollbars=yes,res izable=yes':'scrollbars=no,resizable=no';
var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +
',toolbar=no,status=no,menubar=no,' + winresize;
if(win==null || win.closed)
win=window.open(URL, winname, winprops);
win.focus();
document.onclick=winfocus;
}
</script>
</head>
<body>
<p><a href="http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf"
onclick="newWindow('http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf',500,400,'resize');return
false">Link 1</a></p>
<p><a href="http://grants.nih.gov/grants/funding/phs398/biosketch.pdf"
onclick="newWindow('http://grants.nih.gov/grants/funding/phs398/biosketch.pdf',500,400,'resize');return
false">Link 2</a></p>
</body>
</html>

Nov 2 '06 #2

P: n/a

johkar wrote:
johkar wrote:
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.

Sorry, here is correct HTML:

<!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>Untitled Document</title>
<script type="text/javascript">
var win;
function winfocus(){
if(!(win==null || win.closed))
win.focus();
}

function newWindow(myurl,mywidth,myheight,resize){
var myDate=new Date();
var myTime=myDate.getTime();
var URL=((myurl.indexOf('?') -1))?myurl + '&time=' + myTime:myurl +
'?time=' + myTime;
var w=mywidth;
var h=myheight;
var winname='popWindow';
var winl = (screen.width - w) / 2, wint = (screen.height - h) / 2;
var
winresize=((resize=='resize'))?'scrollbars=yes,res izable=yes':'scrollbars=no,resizable=no';
var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +
',toolbar=no,status=no,menubar=no,' + winresize;
if(win==null || win.closed)
win=window.open(URL, winname, winprops);
win.focus();
document.onclick=winfocus;
}
</script>
</head>
<body>
<p><a href="http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf"
onclick="newWindow('http://www.nsf.gov/pubs/2007/nsf07505/nsf07505.pdf',500,400,'resize');return
false">Link 1</a></p>
<p><a href="http://grants.nih.gov/grants/funding/phs398/biosketch.pdf"
onclick="newWindow('http://grants.nih.gov/grants/funding/phs398/biosketch.pdf',500,400,'resize');return
false">Link 2</a></p>
</body>
</html>
I found the solution here: http://tinyurl.com/yd54h8

Nov 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.