PDA

View Full Version : defining browser size


sawyer1370
01-27-2003, 06:03 PM
I need to create a page that I define the size of that page. Similiar to a pop-up, but I need to define the page size in that page, and not from a link on a different page. I looked around and couldn't find anything quickly, so I thought someone could help me out.

thanks

ConfusedOfLife
01-27-2003, 06:29 PM
Use this:

<BODY>
<script>
function resize()
{
window.resizeTo(200,800); // X and Y of the page.
}
</script>
<input type="button" value="Resize" onclick="resize()">
</BODY>

sawyer1370
01-27-2003, 06:31 PM
any way I can get ride of the toolbar, scrollbars, location, statusbar?

brothercake
01-27-2003, 07:46 PM
no - you can only manipulate window features of a window you created

ConfusedOfLife
01-28-2003, 10:46 PM
As brothercake said it's no way but opening a window by window.open and do all the manipulations. In that case, you propably do not like to have the first window opened, but then you see that it's no way to close the main window without the clients confirmation.
Zoobie found a work around for this that I bring in here.
Let's say your main page that the user opens is main.html, so, here it is:

<html>
<head>
<script>
function fullwin(){
window.open("2.html","","toolbar=no; width=400; height=800")
}
onLoad = fullwin();
</script>
<script>
function bye() {
self.opener = this;
self.close()
}
</script>
</head>
<body onload="bye()">
</body>
</html>


And the page that you wana be resized is 2.html :

<html>
<head>
</head>
<body bgcolor="black" style="margin:0;padding:0; overflow:hidden;">
<table align="right">
<tr>
<td>
<input type="button" value="X" style="font:bold 15 tahoma; background-color:black;color:red; border:1 ff0000 solid;height:20;width:20;cursor:hand;" onclick="window.close();"></td>
</tr>
</table>
<br><br>
<div align="center">
<span style="font:bold 88 comic sans MS; color:blue">2.html</span>
<br>
</div>
</body>
</html>


What you're doing acutally is that you put a page in the middle, called main.html. Your real page that the user should see is 2.html, but when he/she enters www.yoursite.com, then main.html gets opened and it opens your real page and it also closes itself without asking for clients confirmation! It happens very fast that nobody can understand what really happend! By this way you can make fullscreen pages without leaving the first page opened and also lots of other effects that you want!

sawyer1370
01-28-2003, 11:55 PM
thanks for all the feedback, it has been very helpful.