Solved

Open browser in predefined width & height?

Posted on 1999-01-23
8
255 Views
Last Modified: 2012-08-13
On starting an html page, how can I force the browser to open as a window of, lets say, 300 x 300 pixels? I know how to open a second window with predefined mesures, so that is not the question. I'm talking about the first one. Can it also be centered on the screen?
0
Comment
Question by:Zoroaster
  • 4
  • 2
  • 2
8 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 1280074
Use javescript method window.open like this:

<FORM NAME="myform">
<INPUT TYPE="button" NAME="Button1" VALUE="Open Sesame!"
   onClick="window.open
   ('sesame.html', 'newWin', 'scrollbars=yes,status=yes,width=300,height=300')">
</FORM>


============================================================

[windowVar = ][window].open("URL", "windowName", ["windowFeatures"])

windowVar is the name of a new window. Use this variable when referring to a window's properties, methods, and containership.

URL specifies the URL to open in the new window.

windowName is the window name to use in the TARGET attribute of a <FORM> or <A> tag. windowName can contain only alphanumeric or underscore (_) characters.

windowFeatures is a comma-separated list of any of the following options and values:

   toolbar[=yes|no]|[=1|0]
   location[=yes|no]|[=1|0]
   directories[=yes|no]|[=1|0]
   status[=yes|no]|[=1|0]
   menubar[=yes|no]|[=1|0]
   scrollbars[=yes|no]|[=1|0]
   resizable[=yes|no]|[=1|0]
   width=pixels
   height=pixels

0
 

Author Comment

by:Zoroaster
ID: 1280075
I was affraid to get this kind of answer... Although well documented, this was not the question. I stated clearly that I want to open the FIRST page with predefined mesures, NOT the second or third. Can you review this?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1280076
Guess the only way to do this is to write an ActiveX component that uses the MoveWindow api function. But then you will have annoying security warnings etc.
0
 

Author Comment

by:Zoroaster
ID: 1280077
OK, I'll leave the question open for a few more days, awaiting some more comments. If there is nog solution, I'll grade this for you. Thanks anyway for your help.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:hide011199
ID: 1280078
you can change current windows size(for NN4 or IE4), below.


<HTML>
<HEAD>
<SCRIPT Language="JavaScript">
<!--
scrWidth = screen.width;
scrHeight = screen.height;
window.resizeTo(300,300);
window.moveTo(scrWidth/2-150, scrHeight/2-150);
// -->
</SCRIPT>
</HEAD>


<BODY>
</BODY>
</HTML>

thanks.
0
 

Author Comment

by:Zoroaster
ID: 1280079
Yes, Hide, this is exactly what I want. I'll reopen the question for you. Sorry Epsylon, but I'll have to reject your answer. Thanks anyway for your help.
0
 

Accepted Solution

by:
hide011199 earned 20 total points
ID: 1280080
you can change current windows size(for NN4 or IE4), below.

<HTML>
<HEAD>
<SCRIPT Language="JavaScript">
<!--
scrWidth = screen.width;
scrHeight = screen.height;
window.resizeTo(300,300);
window.moveTo(scrWidth/2-150, scrHeight/2-150);
// -->
</SCRIPT>
</HEAD>


<BODY>
</BODY>
</HTML>

thanks.

0
 

Author Comment

by:Zoroaster
ID: 1280081
This works very fine indeed. Thanks, hide.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now