Click to See Complete Forum and Search --> : specifying browser window size
Nulrick
01-28-2004, 12:44 PM
Hi!
I'm looking for a script so that the browser window opens to a specified sized..
anybody have some helpful info on this?
Thanks!!
sciguyryan
01-28-2004, 12:55 PM
If you aree talking about opening a new window to a specific size put:
window.open(,"FileName.html","width=1234 hight=1234")
but, if you mean resize the current window then put this for relative resize: window.resizeBy(deltaX,deltaY)
if you mean resize to an absolute size then use this:
window.resizeTo(outerWidth,OuterHight)
Hope that helps.
Nulrick
01-28-2004, 01:31 PM
Thanks Ryan..
I'm not sure if these options go in the code of the page to be resized.. or in the page that has a link to that page?
also, to be more specific, I want a page that when opened will be 800px wide by 600px height.. (this is the size for the actual window, not including the browser bars and such..)
so, because I am really poor at writing javascript, how exactly would a write this out?
Paul Jr
01-28-2004, 01:50 PM
<a href="page.html" onclick="window.open(href, 'WinName', 'height=600, width=800'); return false;">Open Window</a>
Nulrick
01-28-2004, 02:20 PM
well, it doesn't seem to make a difference.. I've tested it on macs and PCs.. and in both I.E. and Netsscape.. I've changes the width and height to several sizes, but it has no effect.
but as I'm troubleshooting, two things come to mind. I want this to open in a new, blank browser window.. on PCs, the new browser window opens and fills the screen vertically.. (both in I.E. and Netscape). On macs, the new window opens at a slightly lower positioning than the other browser window.. can I control this?
Nulrick
01-28-2004, 02:22 PM
this is how I'm writing the code:
<a href="http://www.rnkvoip.com" target=_blank onclick="window.open("http://www.rnkvoip.com", 'height=200, width=200'); return false;">
Paul Jr
01-28-2004, 02:27 PM
Well, I don't have a Mac, but this seems to work fine for me.
<a href="about:blank" onclick="window.open(href, '', 'height=600, width=800, left=0, top=0'); return false;">Open Window</a>
That will open a blank window 600 pixels tall, 800 pixels wide, and smack-dab against the left and top of the screen (I don't see why it wouldn't?).
Paul Jr
01-28-2004, 02:29 PM
First, remove the target="_blank" part. Then either remove the double quotes around the URI in the window.open() function, and replace them with single quotes, or replace the URI, with the double quotes, with href.
Nulrick
01-28-2004, 03:12 PM
huh? honestly, I lost you. I've tried this on six PCs.. strange how it works for you but not here..confusing
Paul Jr
01-28-2004, 03:15 PM
Lol. You might find this link a bit more helpful.
http://www.w3schools.com/js/js_window.asp
Nulrick
01-28-2004, 03:24 PM
got it! don't know.. must have been a typo or space or some glitch.. but while I'm at it, how can I get the menu bar to show? and is there an attritbute so that the window can be resized?
Paul Jr
01-28-2004, 03:43 PM
Woo! Glad you got it working.
By default, such things as the menu bar, directories, addy bar, and such, are off with the window.open() function.
So just add menubar=yes, resizable=yes into your window.open() function, someplace along next to the width and height or some such place.
Nulrick
01-28-2004, 04:22 PM
thanks for all of your help and your patience!
http://www.rnktel.com/
(then click on anything about "VOIP")
Paul Jr
01-28-2004, 04:25 PM
You're welcome, glad you got it workin'. :D
aidanmack
05-17-2006, 08:15 AM
Hi im using the code below to open a window in a specific size and it works great!...
<a href="http://www.thepageiwanttoload.co.uk" onclick="window.open(href, '', 'height=600, width=420, left=0, top=0'); return false;">More info..</a>
However is it possible to get a scroll bar down the left hand side?
Is it a diffrent type of window that i need it to open?
thing is if i make a simple html page that so long u need to scroll...
It wont scroll if i use the above code.
felgall
05-17-2006, 03:38 PM
'height=600, width=420, left=0, top=0, scrollbars=yes'
aidanmack
05-17-2006, 04:34 PM
Bonza!
thanks very much. ... will give that a go.
aidan