Solved

Open browser in predefined width & height?

Posted on 1999-01-23
8
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

728 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