Jump to content

Resize window


djp1988

Recommended Posts

Hi guys, I'm working on a IM chat system, I've got a page devoted to it, so it's sort of like a pop up but I'm trying to avoid using a pop up window because the user may have a setting blocking pop ups.So what I've done so far is open a new page in a new window and I'm using window.resize(w, h) to resize the window to my desired size.But this as the method states, resizes the window, and so takes into account menu bars/ status bars etc which I cannot account for.So has anyone ran into this problem and have a work around, or should I just revert to a traditional pop up from which I can control these parameters.Your ideas will be interesting,Thanks.

Link to comment
Share on other sites

Despite descriptions of window.open, most browsers today limit which features you can control, and they're sometimes different from each other. I'd be inclined to open a window big enough that it serves your purpose, even if that makes it a little too big, and then assume the user will resize it to his needs.

Link to comment
Share on other sites

You could use window.innerHeight/Width and window.outerHeight/Width to figure out the amount of space required for the menus and scrollbars. Ie,var menu_space = window.outerHeight - window.innerHeight;var scrollbar_space = window.outerWidth - window.innerWidth;Then add that to the height and width you use for your popup window.The only problem with this is that IE doesn't support these properties and Opera doesn't seem to return correct values for the outerHeight/Width. But FF, Safari, and Chrome seem to work ok. You could check to see if the property exists, and if it does use it, if it doesn't just define your normal height and width. The values that Opera returns might be suitable, I'm not sure. You'd have to test it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...