Open Screen Full Window

  • Thread starter Larry R Harrison Jr
  • Start date
L

Larry R Harrison Jr

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
 
H

Harag

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;
}
 
G

Grant Wagner

Harag said:
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/author/dhtml/reference/methods/open_0.asp />
Netscape 4 (although most of this stuff is fairly cross-browser): <url:
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202731
/>
Gecko-based browsers (Mozilla, Firefox, Camino, Netscape 7): <url:
http://www.mozilla.org/docs/dom/domref/dom_window_ref76.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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top