Solved

Open browser in predefined width & height?

Posted on 1999-01-23
8
258 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

808 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