Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read browser window properties

Status
Not open for further replies.
Mar 3, 2006
25
thread216-1125568 was not answered and I'm curious. I'm writing a web based application and I'd like to query window properties for possible action. For instance:
Code:
if(window.toolbar.visible == true)  {
window.open('/startup.html','','width=700, height=500, left=0, top=0, screenX=0, screenY=0, location=0, menubar=0');
}
I want my application to check if the toolbar is visible and if it is then I want to open a new window with the toolbar hidden. This script works great in Firefox but gives an error in IE. Does IE have a similar window property I can query.

Tusan Tuk
Rois
 
My answer now is the same as then - there's no similar property that I know of to do this in IE.

It is possible that you could work it out based on the height of the window furniture... something like this:

Code:
var initialWidth = document.body.clientWidth;
var initialHeight = document.body.clientHeight;
window.resizeTo(initialWidth, initialHeight);
var widthDelta = initialWidth - document.body.clientWidth;
var heightDelta = initialHeight - document.body.clientHeight;
window.resizeTo(initialWidth + widthDelta, initialHeight + heightDelta);

That code will take the current inner dimensions of the window, resize the browser to them, and then take the new dimensions. It then restores the window size.

At this point, you know the width & height of all the furniture.

My IE6 has a heightDelta of 198, but with toolbars turned off, it would be much less.

However, relying on the height of the furniture would be very flaky if you had no idea what toolbars, etc, the user had installed or turned on. You could probably assume something like if heightDelta < 50 (or whatever value you find works from your testing) then no toolbars are turned on.

So, while this will not be 100% reliable, it might be a good indicator.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
The method you mentioned does sound a little unreliable so I think I'll just pop-up an alert letting the user know they shouldn't use the navigation buttons.

Thanks Dan

Rois Cannon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top