472,121 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

maximise window problem with taskbar

If I use this code to maximise a browser window:

window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);

it works but on Windows the user can have a taskbar visible and the
browser window goes behind it.

Is there a way to know where the taskbar is?

Andrew Poulos
Jul 23 '05 #1
4 6213
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 >


--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
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);
window.resizeTo(screen.availWidth, screen.availHeight);

should be what you're looking for.

Greetings,
Jan
Jul 23 '05 #3
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

Jul 23 '05 #4
Jan-Christoph Ihrens wrote:
Hello Andrew,
This is a public newsgroup, not private e-mail.
[...] if you absolutely want to maximize the window,
take a closer look at the screen object:

window.moveTo(screen.availLeft, screen.avail.Top);
window.resizeTo(screen.availWidth, screen.availHeight);

should be what you're looking for.


It should not, see [de] <http://praast.de/ffq/abfrage/#monitor>.
PointedEars
--
This sig intentionally left blank.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Shayne H | last post: by
18 posts views Thread by D Witherspoon | last post: by
8 posts views Thread by WindAndWaves | last post: by
29 posts views Thread by wayne | last post: by
reply views Thread by Rob Nicholson | last post: by
4 posts views Thread by Blaine | last post: by
1 post views Thread by Torben Laursen | last post: by
reply views Thread by leo001 | 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.