472,096 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

Open Screen Full Window

I have pull-down menus in javascript and I have the code for opening a link
in a new window. But I want it to open a full-sized window. I can't figure
out the syntax. What I have so far:

Menu5_5_1=new Array("'Lonely Church","javascript:window.open
('http://www.photo.net/photodb/photo?photo_id=2640310')","",0,20,300);

That works fine, except I can't figure out how to modify it to make it open
full-screen.

Tips?

LRH
Jul 23 '05 #1
2 4280
On Fri, 27 Aug 2004 12:46:42 -0700, "Larry R Harrison Jr"
<no***@noone.com> wrote:
I have pull-down menus in javascript and I have the code for opening a link
in a new window. But I want it to open a full-sized window. I can't figure
out the syntax. What I have so far:

Menu5_5_1=new Array("'Lonely Church","javascript:window.open
('http://www.photo.net/photodb/photo?photo_id=2640310')","",0,20,300);

Loop up more info on the window.open() method, before the end bracket
there is more options you can put in it.

window.open('file', 'winname', 'features');

eg
window.open('photo.asp', 'PictureWindow', 'width=300, height=300')

if you want to do full screen in IE then put "fullscreen" in the
features part.

below is the open window script I use.

HTH

Al.
function newWindow(sFilenameToView, sWindowName, iWidth, iHeight,
sCanScroll, bCanResize, iLeft, iTop, sExtraSettings, bReplaceHistory)
{
var oNewWin = null;
if (!sExtraSettings) {sExtraSettings='';}
// iWidth/iHeight=-1 for netscape to go "near as damit" full
screen
// NS user needs to press F11 to go true full screen.
if (iWidth == -1 || iHeight == -1) {
sExtraSettings =
sExtraSettings.replace(/fullscreen/gi, '');
if (sExtraSettings) {sExtraSettings += ',';}
sExtraSettings += 'fullscreen, outerWidth=' +
screen.width + ', outerHeight=' + screen.height;
iLeft = 0;
iTop = 0;
}
var iLeftPosition = iLeft;
var iTopPosition = iTop;
// iLeft/iTop=-1 centers the newwindow on the screen
if (iLeft == -1 || iTop == -1) {
iLeftPosition = (screen.availWidth) ?
(screen.availWidth - iWidth) / 2 : 0;
iTopPosition = (screen.availHeight) ?
(screen.availHeight - iHeight) / 2 : 0;
}

var sWindowSettings = 'height=' + iHeight + ',width=' + iWidth
+ ',top=' + iTopPosition + ',left=' + iLeftPosition + ',scrollbars=' +
sCanScroll + ',resizable=' + bCanResize + ',' + sExtraSettings;
oNewWin = window.open(sFilenameToView, sWindowName,
sWindowSettings, bReplaceHistory);
oNewWin.focus();
return oNewWin;
}
That works fine, except I can't figure out how to modify it to make it open
full-screen.

Tips?

LRH


Jul 23 '05 #2
Harag wrote:
On Fri, 27 Aug 2004 12:46:42 -0700, "Larry R Harrison Jr"
<no***@noone.com> wrote:
I have pull-down menus in javascript and I have the code for opening a link
in a new window. But I want it to open a full-sized window. I can't figure
out the syntax. What I have so far:

Menu5_5_1=new Array("'Lonely Church","javascript:window.open
('http://www.photo.net/photodb/photo?photo_id=2640310')","",0,20,300);

Loop up more info on the window.open() method, before the end bracket
there is more options you can put in it.

window.open('file', 'winname', 'features');

eg
window.open('photo.asp', 'PictureWindow', 'width=300, height=300')


The 3rd parameter should not contain any spaces. Some user agents do not honor
your "features" if you include any white space.
if you want to do full screen in IE then put "fullscreen" in the
features part.


Documentation for window.open():

IE: <url:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp />
Netscape 4 (although most of this stuff is fairly cross-browser): <url:
http://devedge.netscape.com/library/...w.html#1202731
/>
Gecko-based browsers (Mozilla, Firefox, Camino, Netscape 7): <url:
http://www.mozilla.org/docs/dom/domr...6.html#1019331 />

Note that the Gecko DOM reference appears incomplete. I believe the features
list for window.open() on Gecko-based browsers supports both screenX/Y and
top/left (I'm probably wrong and I'm too lazy to test it).

Also, Gecko-based browsers support "fullscreen=1", but it is not the same as the
effect you get when you do it in IE.

As a general rule-of-thumb when it comes to window.open() there is no general
rule-of-thumb. You'll want to check the documentation for each user agent you
want to support, then test the resulting code to ensure it works as documented.

And after all that, there's no guarantee your attempt to open a new window in my
user agent will be honored anyway. window.open() in my user agent either a) does
nothing or b) if I really need the window to perform some task, it opens in a
new tab which will not be resizable.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

40 posts views Thread by Brian Jorgenson | last post: by
5 posts views Thread by Sean Berry | last post: by
6 posts views Thread by Mateo | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.