Solved

Open browser in predefined width & height?

Posted on 1999-01-23
8
256 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now