Resize browser window... why such a pain?

J

jef

I have an Intranet application that is targeted to IE browsers only.
It is also designed explicitly to fit an 800x600 window. That said, I
wish to ensure that the browser window sizes appropriately when they
log in. I'm using this right now:

<HEAD>
<title>My Login Page</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<script type="text/javascript">
{
window.resizeTo(828,732)
}
</script>
</HEAD>
 
J

jef

Oops... the rest of the post got chopped off.

My existing solution is funky because it only works if the user has the
default toolbar/menubar configuration of IE. I need a way to force the
window to resize based on the content being 800x600 regardless of the
menubar/toolbar height.
 
R

Randy Webb

jef said:
I have an Intranet application that is targeted to IE browsers only.
It is also designed explicitly to fit an 800x600 window. That said, I
wish to ensure that the browser window sizes appropriately when they
log in. I'm using this right now:

<HEAD>
<title>My Login Page</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script type="text/javascript">
{window.resizeTo(828,732)}
</script>
</HEAD>

Since you are using a lot of IE specific items already, I assume your
intranet is IE only. If it is, then you can open a new window, the size
you want, with the parameters you want, and then close the original
window with window.close(). To get IE to allow you to close a window
that you didn't open with script, set the original window's .opener
property to anything you like and then it will be close-able by script.
 
R

RobG

jef said:
Oops... the rest of the post got chopped off.

My existing solution is funky because it only works if the user has the
default toolbar/menubar configuration of IE. I need a way to force the
window to resize based on the content being 800x600 regardless of the
menubar/toolbar height.

Have a poke around here and see if something suits:

<URL:http://www.quirksmode.org/viewport/compatibility.html>

clientWidth/Height may figure in the solution.
 
D

Dietmar Meier

jef said:
I have an Intranet application that is targeted to IE browsers only.
It is also designed explicitly to fit an 800x600 window.

You should rather change that design, but this should help you for
the moment:

function resizeCanvas(nWidth, nHeight) {
var nDX, nDY, sMode, oCanvasContainer;
if ((sMode = document.compatMode) && sMode == "CSS1Compat") {
oCanvasContainer = document.documentElement;
}
else {
oCanvasContainer = document.body;
}
if (oCanvasContainer) {
nDX = nWidth - oCanvasContainer.clientWidth;
nDY = nHeight - oCanvasContainer.clientHeight;
if (!isNaN(nDX) && !isNaN(nDY) && window.resizeBy) {
window.resizeBy(nDX, nDY);
}
}
}
onload = function() {
resizeCanvas(800, 600);
}

ciao, dhgm
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top