By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,478 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,478 IT Pros & Developers. It's quick & easy.

resize browser window on load

P: n/a
how would i resize a browser window to a specific size as the page loads,
using html or javascript

Jul 23 '05 #1
Share this Question
Share on Google+
25 Replies


P: n/a
On Mon, 6 Sep 2004 17:35:17 +0800, chris wrote:
how would i resize a browser window to a specific size as the page loads,
using html or javascript


Why? What is in the pages?

Most of the time it is better to design a
page that fits any screen and let the user
retain control of the size themselves.

Please note that cross-posting to three groups
is generally frowned upon, though I note that
you were unsure which group was best and
did not commit the 'sin' of multi-posting..

I will set the Follow-Ups to the best group,
should you decide to do such a thing,
comp.lang.javascript.

(While the HTML folks might be more aware of
how to make a page 'squeezy', the JS guru's
are certainly familiar with it.)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2

P: n/a

"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page loads,
using html or javascript


Leave the user's window alone.
It might be your website, but it is their computer.

-Karl
Jul 23 '05 #3

P: n/a
"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page loads,
using html or javascript


<html>
<head>
<title>resizeto.htm</title>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">
</body>
</html>
Jul 23 '05 #4

P: n/a

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:nK%_c.253041$8_6.236481@attbi_s04...
"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page loads, using html or javascript


<html>
<head>
<title>resizeto.htm</title>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">
</body>
</html>

Congratulations. You've shown the OP a great way to confuse and annoy
visitors.

-Karl
Jul 23 '05 #5

P: n/a
Karl Groves wrote:
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:nK%_c.253041$8_6.236481@attbi_s04...
"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page
loads,
using html or javascript


<html>
<head>
<title>resizeto.htm</title>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">
</body>
</html>


Congratulations. You've shown the OP a great way to confuse and annoy
visitors.


Not only that, but a method that fails in some scenarios.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #6

P: n/a
"Karl Groves" <ka**@NOSPAMkarlcore.com> wrote in news:chi1uq$sru$1@ngspool-
d02.news.aol.com:

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:nK%_c.253041$8_6.236481@attbi_s04...
"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
> how would i resize a browser window to a specific size as the page loads, > using html or javascript


<html>
<head>
<title>resizeto.htm</title>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">
</body>
</html>

Congratulations. You've shown the OP a great way to confuse and annoy
visitors.


So you think we should hide information from them?

The next thing you know, we'll stop teaching chemistry in high school, lest
anybody figure out how to make a bomb.
Jul 23 '05 #7

P: n/a
"chris" <so*****@here.com> wrote in news:41********@funnel.arach.net.au:
how would i resize a browser window to a specific size as the page
loads, using html or javascript


The real question is, how could you design your page better so it doesn't
need this behavior. After all, you can't do what you want on many
browsers, including ones with javascript selectively turned on.
Jul 23 '05 #8

P: n/a
On 6 Sep 2004 17:13:40 GMT, Sam Hughes <hu****@rpi.edu> wrote:
"Karl Groves" <ka**@NOSPAMkarlcore.com> wrote in
news:chi1uq$sru$1@ngspool-
d02.news.aol.com:
Congratulations. You've shown the OP a great way to confuse and annoy
visitors.


So you think we should hide information from them?

The next thing you know, we'll stop teaching chemistry in high school,
lest
anybody figure out how to make a bomb.


There's a difference, in my opinion.

First, if we teach the chemical method of producing a huge explosion, we
also must responsibly mention that it's probably not a good idea to do
this in your basement or classroom.

Second, and I've used this analogy before, if someone wrote to you asking
what the best methods of suicide were, and it was clear from their message
that the question was not merely academic, I'm sure you'd be reluctant to
entertain the idea of suicide with this person. Rather, I'd hope you'd
attempt to help them out of their current situation toward a more healthy
one.

When people ask questions which are not answerable directly without ending
up as suporting poor practice, and we do so anyway, we're advising someone
to do something which is bad for the web.

This is why so many questions here are answered with "Why do you want to
do this? It's going to lead to no good." Because it's the only responsible
answer.
Jul 23 '05 #9

P: n/a
Neal <ne*****@yahoo.com> wrote in
news:op**************@news.individual.net:
When people ask questions which are not answerable directly without
ending up as suporting poor practice, and we do so anyway, we're
advising someone to do something which is bad for the web.

This is why so many questions here are answered with "Why do you want
to do this? It's going to lead to no good." Because it's the only
responsible answer.


But alas, in this case, other people have already given that aspect of the
answer.
Jul 23 '05 #10

P: n/a
On 6 Sep 2004 17:13:40 GMT, Sam Hughes wrote:
Congratulations. You've shown the OP a great way to confuse and annoy
visitors.
So you think we should hide information from them?


What, the visitors? No, of course not.
Ohh.. if you mean the naiive web-authors? Probably.
The next thing you know, we'll stop teaching chemistry in high school,
Nobody ever needed Javascript to make
bread rise, or perform an alkilinity
or soil or water test...
..lest anybody figure out how to make a bomb.


I do not think there is any case to compare the two.

[ F'Ups set to c.l.js ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #11

P: n/a

"Sam Hughes" <hu****@rpi.edu> wrote in message
news:Xn**************************@130.133.1.4...
"Karl Groves" <ka**@NOSPAMkarlcore.com> wrote in news:chi1uq$sru$1@ngspool- d02.news.aol.com:
Congratulations. You've shown the OP a great way to confuse and annoy
visitors.
So you think we should hide information from them?

The next thing you know, we'll stop teaching chemistry in high school,

lest anybody figure out how to make a bomb.


A plethora of lessons learned today on alt.html.
Ladies and Gentlemen, Mr. Hughes has just demonstrated the "slippery slope".

-Karl
Jul 23 '05 #12

P: n/a
Lee
Sam Hughes said:

"Karl Groves" <ka**@NOSPAMkarlcore.com> wrote in news:chi1uq$sru$1@ngspool-

Congratulations. You've shown the OP a great way to confuse and annoy
visitors.


So you think we should hide information from them?

The next thing you know, we'll stop teaching chemistry in high school, lest
anybody figure out how to make a bomb.


Your analogy is wrong.
If a high school student asks what he could mix together to get
an explosion, it would be irresponsible to give him an easy to
follow recipe. Particularly if you don't at least mention that
it would be a really bad idea to do it.

Jul 23 '05 #13

P: n/a
Sam Hughes wrote:
The next thing you know, we'll stop teaching chemistry in high school, lest
anybody figure out how to make a bomb.


Teach Chemistry by all means, but if a student comes up to you and asks
for a recipe for Semtex, be suspicious.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./ed_harcourt/from_every_sphere/09_watching_the_sun_come_up.ogg

Jul 23 '05 #14

P: n/a
JRS: In article <ch**********@ngspool-d02.news.aol.com>, dated Mon, 6
Sep 2004 09:27:13, seen in news:comp.lang.javascript, Karl Groves
<ka**@NOSPAMkarlcore.com> posted :

"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page loads,
using html or javascript


Leave the user's window alone.
It might be your website, but it is their computer.


Setting the window size is a perfectly reasonable thing to do, in some
circumstances.

Consider <URL:http://www.merlyn.demon.co.uk/js-quick.htm>; it is
primarily for my benefit as a local page, but I publish it so that
others may make modify and use their own local copy. It presents some
controls in a form, and sizes itself to fit those controls in my
browser. IIRC, it also fits in MSIE 5.5 or 6; those with browsers in
which it does not fit can adjust the numbers.

Consider my private local home page; it has
<BODY onLoad="window.resizeTo(640, 960)">
because that suits my way of working (/inter alia/, I can normalise the
size of a displayed page by Home, Back).
Granted, resizing can be, and commonly is, misused; but there is no
reason to assert that the poster must want to misuse it. A conditional
warning is enough.
After resizing, one may wish to scroll to a particular location. There
are numerical scrolling commands; but it may be better to set focus to a
suitable element, so that the desired point is reached even if more text
is added above it.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #15

P: n/a
In article <op**************@news.individual.net>, ne*****@yahoo.com
says...
The next thing you know, we'll stop teaching chemistry in high school,
lest
anybody figure out how to make a bomb.

There's a difference, in my opinion.
First, if we teach the chemical method of producing a huge explosion, we
also must responsibly mention that it's probably not a good idea to do
this in your basement or classroom.


That's kind of what happened here. The information was supplied, and
the warning was also given. Different posts, but it happened.
--
WebcastMaker
Webcasting for free
http://www.webentations.com
Jul 23 '05 #16

P: n/a
On Mon, 6 Sep 2004 18:44:57 -0400, WebcastMaker <in**@invalid.com> wrote:
In article <op**************@news.individual.net>, ne*****@yahoo.com
says...
> The next thing you know, we'll stop teaching chemistry in high school,
> lest
> anybody figure out how to make a bomb.

There's a difference, in my opinion.
First, if we teach the chemical method of producing a huge explosion, we
also must responsibly mention that it's probably not a good idea to do
this in your basement or classroom.


That's kind of what happened here. The information was supplied, and
the warning was also given. Different posts, but it happened.


True, but when one supplies the info without themselves attaching a
caveat, it sends the message that it's acceptable and no harm will come.
That's like a chemistry teacher telling the kids how to make LSD and the
DARE officer [1] telling them drugs are bad. It's the responsibility of
the chemistry teacher to say that while this is how it's done, it's ilegal
and dangerous and inadvisable and all that.

[1] For those who don't know, DARE = Drug and Alcohol Resistance
Education, a particularly popular (and debatably successful) school
program in the US. A police officer teaches the classes within the school
day.
Jul 23 '05 #17

P: n/a
In article <op**************@news.individual.net>, ne*****@yahoo.com
says...
That's kind of what happened here. The information was supplied, and
the warning was also given. Different posts, but it happened.

True, but when one supplies the info without themselves attaching a
caveat, it sends the message that it's acceptable and no harm will come.
That's like a chemistry teacher telling the kids how to make LSD and the
DARE officer [1] telling them drugs are bad.


well hardly similar, but the point is noted.
--
WebcastMaker
Webcasting for free
http://www.webentations.com
Jul 23 '05 #18

P: n/a
[f-u set to alt.html]
While the city slept, McKirahan (Ne**@McKirahan.com) feverishly typed...
<body onload="moveTo(0,0); resizeTo(400,300);">


Every time you use that script, god kills a kitten...

Cheers,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 23 '05 #19

P: n/a
"nice.guy.nige" <ni********@deadspam.com> wrote in message
news:2q************@uni-berlin.de...
[f-u set to alt.html]
While the city slept, McKirahan (Ne**@McKirahan.com) feverishly typed...
<body onload="moveTo(0,0); resizeTo(400,300);">


Every time you use that script, god kills a kitten...

Cheers,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!


Which god; my God starts with a capital G. :)
Jul 23 '05 #20

P: n/a
On Wed, 08 Sep 2004 18:30:01 GMT, McKirahan wrote:
"nice.guy.nige" <ni********@deadspam.com> wrote in message...
[f-u set to alt.html]
While the city slept, McKirahan (Ne**@McKirahan.com) feverishly typed...
<body onload="moveTo(0,0); resizeTo(400,300);">
Every time you use that script, god kills a kitten...

... Which god; my God starts with a capital G. :)


Yes, the Jealous God, I've heard reference
to Him.

...and He kills an entire litter, as well as
a couple of lambs, when you refer to Him as
<censored, for the sake of kittens and lambs>
....
</censored, for the sake of kittens and lambs>.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #21

P: n/a
Karl Groves wrote:
"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page loads,
using html or javascript

Leave the user's window alone.
It might be your website, but it is their computer.

-Karl


When you design something to be used by potentially billions of people,
you sometimes need to do things that some of those billions won't like.
"You can't please all of the people all of the time." Or even some of
the time, for that matter.

Besides, you're also assuming the poster wants to use it in a way that
annoys the user. What if the link leading to the page has test to
explain it's opening an 200x300 image, for example, in a new smaller
window? Then the user has a *choice* on whether to open it or not.
Clicking the link is the same as giving permission to resize the new
window. Therefore your "It might be your website, but it is their
computer" comment is satisfied...

~Senti
Jul 23 '05 #22

P: n/a
On Sat, 11 Sep 2004 08:28:10 -0600, Sentient Fluid
<se***********@hotmail.com> wrote:

[snip]
Besides, you're also assuming the poster wants to use it in a way that
annoys the user.
Only the pathetic want to annoy the user intentionally, but plenty do it
by accident.
What if the link leading to the page has test to explain it's opening an
200x300 image, for example, in a new smaller window?
The word, "test", really confuses the meaning of that sentence. However,
it's irrelevant.
Then the user has a *choice* on whether to open it or not.


The user already has a choice. Opera and the Gecko family allow middle
clicking to open a link in a new window. Even IE users can do it through
the use of shift-clicking. There are also keyboard equivalents, if needed.

But, when the author starts imposing his or her misguided will on
visitors, their choices change:

1) Put up with pop-ups.
2) Disable Javascript and reload the page. Hopefully, the author didn't
make the page Javascript dependent.
3) Leave.

I invariably choose the latter, unless the content really interests me. I
don't I'll be alone in that decision.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #23

P: n/a
DU
Karl Groves wrote:
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:nK%_c.253041$8_6.236481@attbi_s04...
"chris" <so*****@here.com> wrote in message
news:41********@funnel.arach.net.au...
how would i resize a browser window to a specific size as the page
loads,
using html or javascript


<html>
<head>
<title>resizeto.htm</title>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">
</body>
</html>


Congratulations. You've shown the OP a great way to confuse and annoy
visitors.

-Karl


I would not go that far. It now has become rather well known that
non-MSIE browsers can neutralize easily such trick.
What is and was important to tell the OP was the importance to make his
webpage content scalable, adaptable to any kind of visual web-aware
application, including mobile/SSR devices.
I wouldn't pounce on the fact that info was given but rather the
benefits (for visitors and ultimately for the web master) of thinking
radically otherwise this issue.

DU

--
The site said to use Internet Explorer 5 or better... so I switched to
Netscape 7.2 :)
Jul 23 '05 #24

P: n/a
ME
I always start a new page and insert a 75% width table, aligned to center.
I then insert a 100% table with 2 columns (right margin) and a few rows,
into that one.

This is exactly how YAHOO and GOOGLE's pages Load, like they'll fit anything
they encounter. I will never go back to all of that "detect browser/detect
resolution crap. Thank God for % width tables.

Hope This Helps
W.H. Olives
"Sam Hughes" <hu****@rpi.edu> wrote in message
news:Xn**************************@130.133.1.4...
"chris" <so*****@here.com> wrote in news:41********@funnel.arach.net.au:
how would i resize a browser window to a specific size as the page
loads, using html or javascript


The real question is, how could you design your page better so it doesn't
need this behavior. After all, you can't do what you want on many
browsers, including ones with javascript selectively turned on.

Jul 23 '05 #25

P: n/a
Many would argue against the use of <table> for layout control. However, in the
absense of a reliable mechanism to achieve the variety of layout that can be
achieved using <table> across all browsers, I will continue using <table>.
Certainly there will be a number of browsers which will not render the resulting
HTML correctly, but that list of browsers will almost certainly be smaller than,
and a subset of, browsers which would not understand a CSS-controlled site.

It can be argued that using CSS would result in content that will be readable in
almost all browsers in the absense of CSS, such that Netscape 4 and lynx would
get a series of <div> elements laid out one below the other. However, I would
rather not sacrifice the layout of the page in Netscape 4 in order to support
lynx or other browsers which may not render a <table> site correctly. So yes, I
would rather my sites render correctly for the 1%[1] of people still using
Netscape 4 than for the 0.01%[1] of people using lynx.

I have a pretty firm grasp of the audience using the sites I work on, and that
audience does not include people who would even be aware of the existance of
lynx, let alone how to use it. It also does not include people using portable
devices.

But honestly, if someone is browsing a site using a portable device like a
phone, I don't think it much matters if you use:

<table width="100%">
<tr><td width="33%">...</td></tr>
<tr><td width="33%">...</td></tr>
<tr><td width="33%">...</td></tr>
</table>

or

<div style="position:absolute;top:0px;left:0px;width:33 %;>...</div>
<div style="position:absolute;top:0px;left:34%;width:33 %;>...</div>
<div style="position:absolute;top:0px;left:67%;width:33 %;>...</div>

They are unlikely to get anything approaching usability on most modern Web
sites. I was recently forced to work on a laptop with a 640 x 480 display. I can
not tell you how hostile most sites I visited were to that particular
resolution, let alone something smaller that you might find on a portable
device.
[1] other meaningless statistics may be inserted here

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
ME wrote:
I always start a new page and insert a 75% width table, aligned to center.
I then insert a 100% table with 2 columns (right margin) and a few rows,
into that one.

This is exactly how YAHOO and GOOGLE's pages Load, like they'll fit anything
they encounter. I will never go back to all of that "detect browser/detect
resolution crap. Thank God for % width tables.

Hope This Helps
W.H. Olives

"Sam Hughes" <hu****@rpi.edu> wrote in message
news:Xn**************************@130.133.1.4...
"chris" <so*****@here.com> wrote in news:41********@funnel.arach.net.au:
how would i resize a browser window to a specific size as the page
loads, using html or javascript


The real question is, how could you design your page better so it doesn't
need this behavior. After all, you can't do what you want on many
browsers, including ones with javascript selectively turned on.


Jul 23 '05 #26

This discussion thread is closed

Replies have been disabled for this discussion.