Forum Moderators: open

Message Too Old, No Replies

resizing the browser window after the url loads

         

aweller

9:59 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



I have an html file that is 325x325. When the user loads this page in their browser I want the browser window to resize to the 325x325, with no bars, no scrollers. Can this be done?
If the page name is 'interface.html' what would the code look like?

RonPK

10:54 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi aweller,
May I ask *why* you would want that? I personally hate it when a site tries to resize *my* browser window. And how can you be sure the page is exactly 325 x 325? What if the user decides to use a larger font?

aweller

11:03 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



hello ronpk
i'm using the html document as a readme file on a CD that I am preparing to master. it acts as an interface to some web-based sites, and also to other readme files on the disc. I know the size is exact because there is no text in the html doc., it is just jpg image (325x325) with 4 mapped links. Do you have any ideas how I can make this?

tedster

11:27 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would you be willing to just center that image against whatever body background you want?

Alternately, you could open up to a blank page and then launch the specialized window as a pop-up "onload". You can only change the default chrome on windows that your page opens, not on windows that a user opens.

luckydude

12:32 am on Mar 9, 2004 (gmt 0)

10+ Year Member



Assuming that you want your new window to pop up when the page loads, I have called the function on body load. Or you could just center the image like tedster said. But here is the basic code for your pop-up HTML file.

<html>
<head>
<script language="javascript">
<!--
function popUp()
{
window.open("interface.html","name","width=325,height=325,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
}
//-->
</script>
</head>
<body onload="popUp();">
</body>
</html>

[edited by: tedster at 12:44 am (utc) on Mar. 9, 2004]
[edit reason] fix side scroll [/edit]

aweller

2:52 am on Mar 9, 2004 (gmt 0)

10+ Year Member



tedster & lucky dude-
thanks for the help. when i use luckydude's code a blank browser window opens (using the browser's last dimensional settings), and then the small window (325x325) opens immediately in front of it.
Is there any way to get rid of that big empty browser window? (ie-get it to shut?)The desired effect is to have this little, simple, barless interface sitting on the screen.
Perhaps I'm trying to get html to do something that it cannot...

tedster

6:45 am on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you're asking about is "impossible" on the open web, if you will. Normally your javascript cannot close a window that it did not open, or change its bars, etc.

But since you're working from a CD, there may a possibility of using a "signed javascript" application to bypass the usual security restrictions on a public website.

I know very little about this, except that it exists - never did it myself. Try a Google search, and see if you feel it's a relevant approach.