IE6 / Javascript - Maximize window / windows taskbar location?

S

skull_leader7

Hi all...

I have a javascript question for IE 6. I want to maximize the browser
window and place it on the screen such that it does not end up under
the task bar.

I understand how to resize the window so that its size matches the
area of the screen not taken up by the task bar...

window.resizeTo(screen.availWidth, screen.availHeight);

The question then becomes were to position the window on the screen so
that it doesn't end up partially burried beneath the task bar.

I.E. if I say window.moveTo(0,0) after running the above resize, it
works great if the taskbar is on the bottom of the screen. But if I
do this and the task bar is on the left of the screen, the left side
of the window ends up underneath the task bar. Similarly, I can move
to (for example) window.moveTo(screen.width-screen.availWidth,0),
which will work if the task bar is on the left, but if the task bar is
on the right then the right side of the browser window ends up beneath
the task bar. There is a similar issue when the task bar is on the
top of the screen.

If I could somehow tell, through Javascript, which side of the screen
the task bar is on (top, bottom, left, right), this whole problem
would become trivial. As far as I can tell, there is no way to make
this determination, but if anyone can suggest a way where I can do
this it would be very much appreciated.
 
R

rob^_^

Hi,

You are right. There is no javascript functions to return the TaskBar
attributes.

You could try showModalDialog or showModelessDialog instead of open. Model
windows should display in the top z-Order, covering the Taskbar and Desktop.

Regards.
 
Y

Yuval Rabinovich

Although Javascript 1.2 supports the following:

window.moveTo(screen.availLeft, screen.avail.Top);

it is not implemented in IE yet.

The following will keep your window border always within screen limit. It
will keep same distance for right/left or top/bottom according to your
taskbar size and position. Although not true fullscreen it comes close:

window.moveTo(screen.width-screen.availwidth,screen.height-screen.availheight);
window.resizeTo(screen.availwidth+screen.availwidth-screen.width,screen.availheight+screen.availheight-screen.height);
 

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

Top