Log in

View Full Version : Full-Screen Pop-Up.



Moglizorz
04-21-2007, 11:40 AM
I want a link on my page that opens a full screen pop-up window (with no status bar, address bar etc).
How easy is this to do?

boxxertrumps
04-21-2007, 02:15 PM
You should try to stay away from altering the persons browser windows.

but it is relatively easy.

Here's the code for the buddy list button you see up top:

<a href="#" onclick="window.open('URL',
'TARGET','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,
resizable=yes,width=100&#37;,height=100%'); return false;"></a>
Modified.

jscheuer1
04-21-2007, 02:32 PM
That won't work and, it really cannot reliably be done. This is close but has some fixable and some not fixable problems:


<a href="http://www.google.com/" onclick="window.open(this.href,
'','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,\
top=0,left=0,width='+screen.availWidth+',height='+screen.availHeight); return false;">G</a>

mburt
04-21-2007, 08:38 PM
screen.availWidth/height varies between browsers. In IE, the height overlaps the actual screen height.

boxxertrumps
04-21-2007, 10:35 PM
I see...
I didn't really expect it to, but i had thought JS could use percents like that.

jscheuer1
04-22-2007, 01:52 AM
screen.availWidth/height varies between browsers. In IE, the height overlaps the actual screen height.


I see...
I didn't really expect it to, but i had thought JS could use percents like that.

Yeah, that was mostly what I meant by the fixable part. The thing about IE and screen.availWidth/Height is that IE calculates that before it decides what chrome to assign to the window. So, it adds the chrome (title and scroll bars, etc.) onto those dimensions.

Now, you cannot access the window size across domains but, if you are only launching your own page:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function winopen(url){
var h=screen.availHeight, w=screen.availWidth;
var win=window.open(url,'','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,top=0,left=0,width='+w+',height='+h);
try{
win.resizeTo(w,h);
}
catch(e){
}
return false;
}
</script>
</head>
<body>
<a href="some.htm" onclick="return winopen(this.href);">G</a>
</body>
</html>

will work out. Legacy browsers will barf on try/catch. There are ways to prevent that but, if this is only done locally to open a local page, or with pages on the same domain, it really isn't needed:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function winopen(url){
var h=screen.availHeight, w=screen.availWidth;
var win=window.open(url,'','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,top=0,left=0,width='+w+',height='+h);
win.resizeTo(w,h);
return false;
}
</script>
</head>
<body>
<a href="some.htm" onclick="return winopen(this.href);">G</a>
</body>
</html>