Jan-Christoph Ihrens wrote:
Randy Webb schrieb:
Andrew Poulos wrote:
If I use this code to maximise a browser window:
No, you use it to *attempt* to "maximise" a browser window. Subtle
difference but a huge difference.
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);
What makes you think I want my browser window to be 2048 pixels wide?
it works but on Windows the user can have a taskbar visible and the
browser window goes behind it.
I disagree with the "it works".
Is there a way to know where the taskbar is?
No. Stop trying to tell the user what size to have there windows,
and it becomes a moot point.
<URL: http://allmyfaqs.com/faq.pl?AnySizeDesign >
Hello Andrew,
I absolutely agree with Randy. Nevertheless, if you absolutely want to
maximize the window, take a closer look at the screen object:
window.moveTo(screen.availLeft, screen.avail.Top);
Of Internet Explorer 6SP1, Opera 6.05, Opera 7.54, Firefox 0.9.3, Mozilla
1.7.2 and Netscape 4.78. Only Firefox 0.9.3, Mozilla 1.7.2 and Netscape
4.78 support screen.availLeft/availTop. Your code works as written because
the "undefined" value returned by screen.availLeft/availTop is type
converted to 0 by the moveTo() method (which expects a Number). You may
want to make this type conversion explicit with:
window.moveTo((screen.availLeft || 0), (screen.availTop || 0));
doing this clearly shows that screen.availLeft can be "undefined" or null
on some user agents, and as a result, the coordinates of 0,0 are used in
those cases (which could potentially cover up a task or toolbar residing at
the top or left of the screen).
window.resizeTo(screen.availWidth, screen.availHeight);
window.resizeTo() in Netscape 4.xx resizes the browser's _viewport_ to the
specified values, not the outer browser window dimensions. As a result, you
end up with a window that is both too wide and too tall. The correct way to
resize the window in Netscape (if you insist on doing something or
proactively user hostile) is to adjust window.outerWidth/outerHeight.
window.resizeTo() in Opera 7.54 makes the MDI window inside Opera so wide
and tall that the scrollbar on the right is completely inaccessible. Oddly
enough, Opera 6.05 seems to be a bit more friendly under these
circumstances. It only makes the MDI window the maximum dimensions which
the outer MDI frame can accomodate.
should be what you're looking for.
Thankfully I can configure Firefox and other Gecko-based browsers to ignore
this nonsense entirely. In those cases, this page author will get nowhere
near the behaviour they are expecting.
This should be _clearly_ spelled out. More and more users are taking steps
to prevent Web site authors from messing with their browsers in these ways.
If your public Web site depends on a "fullscreen" window (which can have a
variety of meanings given multiple monitor configurations some users have),
you are fooling yourself if you think you can open everyone's browser
window to fill their screen.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq