PDA

View Full Version : Specified web page size



Freeman
12-19-2005, 02:22 PM
How do I make a page a certain size when it is opened? JF

Twey
12-19-2005, 02:56 PM
A page or a window?

Freeman
12-19-2005, 05:05 PM
The window. I need it to be full screen when it is opened. Thanks for the help, JF

Twey
12-19-2005, 08:06 PM
window.open('http://www.url.com/', '', 'width=' + screen.width + ', height=' + screen.height);

Freeman
12-20-2005, 03:08 PM
Do I put it into srcipt tags?

Freeman
12-20-2005, 03:15 PM
Ok here is what I want to do. I have a work form and I need it to be a certain size when they click on the hyperlink. Do I put this with the hyperlink or on the page that is going to be opened? Thanks for the help, JF

jscheuer1
12-20-2005, 04:41 PM
Here is one good way to do it:


<a href="workform.htm" onclick="window.open(this.href, '','width='+screen.availWidth+', height='+screen.availHeight+', top=0, left=0');return false;">Work Form</a>

Freeman
12-20-2005, 05:00 PM
When I put that In it makes the window full screen even over the task bar. It also takes away the scroll bar on the side. I would like it to still have the scroll bar on the side and not cover up the task bar on the bottom. JF

jscheuer1
12-21-2005, 06:30 AM
That's odd, that is what screen.avail is for. This used to work for IE and still does for FF. It is still better in IE than just plain screen, just not better enough. To overcome this in IE, put this in the head of the page:


<script type="text/javascript">
var hAdjust=document.all? 27 : 0;
var wAdjust=document.all? 4 : 0;
</script>

To add back scrollbar(s) and take advantage of our new adjust variables:


<a href="workform.htm" onclick="window.open(this.href, '','width='+[screen.availWidth-wAdjust]+', height='+[screen.availHeight-hAdjust]+', top=0, left=0, scrollbars=yes');return false;">Work Form</a>

Twey
12-21-2005, 03:03 PM
var wAdjust=document.all? 4 : 0;A 4px wide scrollbar? :confused:

jscheuer1
12-21-2005, 03:36 PM
A 4px wide scrollbar? :confused:

No, there are two things going on with this one. The 4px is just so that IE will not make the window too wide - with or without the scrollbar. Adding in a scrollbar doesn't (in IE, in this case) make the outer dimensions of the window any different. 4px, incidentally is about the width of the typical horizontal chrome on a IE window, those thin border lines that demarcate the left and right sides of the browser window.

jscheuer1
12-21-2005, 05:11 PM
I've discovered a better method. The problem with IE and screen.avail appears to not be that it gets it wrong but rather, that it applies it too soon, before it knows what the chrome for the new window will be. To get around this, put this script in the head of the (launching) page:


<script type="text/javascript">

function openNew(obj){
var newWin=window.open(obj.href, '','width='+screen.availWidth+', height='+screen.availHeight+', top=0, left=0, scrollbars=yes')
if (document.all){
newWin.resizeTo(screen.availWidth, screen.availHeight);
}
}

</script>

Now your link on that (launching) page can look like so:


<a href="workform.htm" onclick="openNew(this);return false;">Work Form</a>

Twey
12-21-2005, 05:24 PM
Ah, I see. The fog clears. :)