You may want to control the size of the browser window which opens when a viewer accesses your web page. The default behavior is for the browser window to open at its last setting (e.g. maximized, or resized according to the viewer's preference). You can force the browser window to open at a specific pixel size (width and height). The viewer can still resize, maximize, or minimize the window once it has opened, but re-opening or refreshing the window will pull it back to the settings you have defined. You will use some simple JavaScript to perform this function. You need to add code to the <head> section and in the <body> tag.
In the <head> section
<script type="text/javascript">
function changeScreenSize(w,h)
{
window.resizeTo( w,h )
}
</script>
function changeScreenSize(w,h)
{
window.resizeTo( w,h )
}
</script>
In the <body> tag
<body onload="changeScreenSize(500,300)">
In this example, the window size has been set to 500 pixels wide and 300 pixels high. Experiment with different width/height pixel values to get the effect you want.
No comments:
Post a Comment