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

The ongoing new-window Resize debate

P: n/a
juglesh <ju*****@nospamRadioKDUG.com> wrote in "Re: how to maximize the
browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12
AM):
[...]
I want to maximize the browser window when I open a new window.[...]
function expand() {
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}


I like availWidth and availHeight, but I'd much rather work with
window.availWidth and window.availHeight. Unfortunately, they just aren't
universally available. When I ran a function to see which ones were
available, most weren't. I tried:

alert("window.width: " + window.width + "\n" +
"window.availWidth: " + window.availWidth + "\n" +
"screen.width: " + screen.width + "\n" +
"screen.AvailWidth: " + screen.AvailWidth + "\n" +
"window.innerWidth: " + window.innerWidth + "\n" +
"screen.innerWidth: " + screen.innerWidth + "\n");

What I got was:
window.width: undefined
window.availWidth: undefined
screen.width: 800
screen.availWidth: 800
window.innerWidth: undefined
screen.innerWidth: undefined

If one could place images, columns, etc., on the basis of the browser's
current WINDOW.width rather than screen.availWidth, everyone could be happy.
Yet, having as I do Internet Explorer 5.5 (and Netscape 4.6) (this isn't an
exhaustive list: this is what I use for most tests), running on Windows ME,
I can say that whatever problems I brought on myself by not having the most
up-to-date versions, I'm at least replicating the conditions of a multitude
of potential visitors, so many of whom haven't upgraded in recent years
either.

Grant Wagner <gw*****@agricoreunited.com> responded (Thursday, January 06,
2005 1:53 PM): [after quoting above code:]
- Does not do anything in Gecko-based browsers appropriately configured
- Results in an MDI window that is both too tall and too wide in Opera
7.54u1
- Results in a window that is actually wider and taller than
screen.availWidth/Height in Netscape 4 (because resizeTo() resizes the
window's viewport, not it's outter dimensions)
- Annoys the user when it does work, since they probably had their
browser the size they wanted it
Noozer" concurred (Saturday, January 01, 2005 12:59 AM): 1) Don't touch my browser size. I'm quite capable of resizing the window if I need to.

2) Don't open a new window. Your site has a browser window, ONE is all you
get. Make good use of it.
So did Sid Ismail (Saturday, January 01, 2005 7:53 AM): Don't open a new window. Don't maximise. Do not pass Go.

It's _my_ browser.
There are valid concerns here, but they can be overcome. One window is not
the ideal for some material when the user knows that the content of the new
window is just a side point and that he likely will return to the first
page. Think of the sites where you are invited to read a disclaimer, an
explanation, a definition or a chart (perhaps shipping charges). Do you
really want the new page to stay within the same window, with it coming with
the worry that the form you may have filled out (radio buttons for a survey,
street address for mail delivery of documentation, etc.) may be blank when
you return to this page? Pop-ups eliminate this worry, because the content
of the first window stays as it is until one returns and deliberately
effects a change.

(There's a lot to be said here for putting a note next to the link on the
first page: "will appear in a new window.")

I take it to be a responsibility that I not abuse screen.availWidth,
..availHeight. What I do in my window.open comment is not specify
"width=800,height=600" but use variables for the width and height of the new
window. And these variables are filled not by merely the results of getting
screen.availWidth, .availHeight, but of subtracting sufficient pixels. If
my variable is filled by "screen.availWidth - 90," I know that I am leaving
sufficient space at the bottom of the screen for the user to see his
taskbar. (I take it for granted that I also use "window.moveTo(0,0)" so
that buffer space at the top and left of the new browser window doesn't
crowd the bottom and right sides off the screen.)

Fred Oz <oz****@iinet.net.auau> brought up another point (Saturday, January
01, 2005 5:43 AM) [...] users were so pissed
off with windows opening full screen that browser makers removed the
ability for programmers to do it. Many browsers also allow the user to
stop JavaScript from resizing or moving windows.

New windows, by default in most browsers, open to the same size as the
current window. So users with full-screen windows will not notice you
setting your new window to full screen, whereas those with their
browsers set smaller will. Consider someone with a large monitor of
say 2560x1600. Or maybe with one desktop spread over two monitors. Do
you really think they want your window over their entire desktop?
Here, too, a responsible programmer doesn't let "screen.availWidth - 90"
(and its availHeight counterpart) end his settings. By setting a maximum
for the variable (if screenHght > 1200 {screenHght == 1200}), one doesn't
force these problems on the user. Quite apart from the problem of a desktop
spread over two monitors, it's just common sense that text becomes difficult
to read when the lines are too wide. Never mind that the user doesn't have
to scroll left and right -- if the line is so wide on a two-foot-wide screen
that the reader needs a straight edge sheet of paper to help him keep his
place, then the programmer has done a disservice.

Grant Wagner knew of that from his own experience when he wrote (Tuesday,
September 21, 2004 1:32 PM)(in "Re: resize browser window on load"): [...] 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.
I know too from my own business travels what it was like to regularly work
(and have after-hours leisure) with a laptop with a 640 x 480 screen. One
has to wonder who the programmers thought they were pleasing with attractive
designs that were disfunctional. Sometimes if it wasn't just for a header
..GIF that spread past the edge of the screen (when the scroller wasn't set
for the right side), the ASCII text wouldn't have been an obstacle course of
constantly scrolling left and right.

W.H. Olives offered a solution to the problem of placement in "Re: resize
browser window on load" (Tuesday, September 21, 2004 12:50 PM): 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.
I agree. I have achieved what I wanted in screen placement through a
judicious use of a mix of tables, including embedded tables.

arkascha wrote in "window resize to required size" (Wednesday, October 20,
2004 9:24 AM) [...] When choosing a fixed window size things look
silly most of the time. Either you have a nearly
empty window or you have to scroll all the time...

So I want to resize the window. Resize it to what size? The size that is
required by the pages content when redered in the browser. That's all :-)

-- hmmm -- I tried around quite a lot with scrollHeigths, offsetWidth and so on, but there does not seem to be any more or less reliable solution.,
Especially not when trying to make stuff usable for different browsers.
Does anyone have a hint what else I can try, where I could look?


As long as it will be the case that programmers are presenting images --
which are almost by definition of fixed size (let's not think of how
gruesome they look when they're blown up to fit an arbitrary amount of
space) -- there is going to be the problem of blank space beyond which the
designer chose not to place additional photographs lest the page become a
scrolling nightmare on a 640-width monitor. (I use pop-ups for picture-rich
pages for this reason, but set the width at no more than about 550, but
often at less than that.)

Summary statement: can JavaScript programmers accept judicious and
responsible use of launching new windows and setting browser width?

--
David Hayes

(remove the name of the programming language from email address to make it
usable)




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


P: n/a
David Hayes wrote:
juglesh <ju*****@nospamRadioKDUG.com> wrote in "Re: how to maximize the
browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12
AM):
[...]
I want to maximize the browser window when I open a new window.[...]


function expand() {
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}

I like availWidth and availHeight, but I'd much rather work with
window.availWidth and window.availHeight. Unfortunately, they just aren't
universally available. When I ran a function to see which ones were


Window size != screen size.
Mick
Jul 23 '05 #2

P: n/a
David Hayes wrote:
[...]
Summary statement: can JavaScript programmers accept judicious and
responsible use of launching new windows and setting browser width?


Limited and judicious use of pop-ups is OK for specialty sites like
galleries, but web sites should be designed first and foremost to
operate without any JavaScript or popups. JS should enhance the
experience, not be the experience unless that is an express or closely
related purpose of the site (say browser games). In all other cases,
web pages must cater for users with JavaScript disabled and users with
browsers that don't support it.

Attempting to ensure your pop-up is reasonably sized is also a good
idea - for assistance with your cross-browser issues, try:

<URL:http://www.quirksmode.org/index.html?/viewport/compatibility.html>

As for returning to a partially completed form, the flow of the site
should be such that users don't have to leave a partially completed
form to read a disclaimer or other important information. The
corollary is that users don't always close the extra windows, they just
click back on the main window (particularly users who surf with
full-screen windows). The plethora of background popups that are
likely to result can become a serious drain performance.

Finally, have had the ability to open links in a new window themselves
from the very early days. The "Back" button also helps here. Further,
the increasing use of tabs makes pop-ups irrelevant. If users know
that they are clicking on a "more information" link, they can choose to
open it in a tab or a new window, then close it or keep it available
for further reference.

An example of a really bad pop-up is:

<A href="javascript:openWindow('blah.html','Popupwind ow',
'scrollbars=yes,resizable=yes,HEIGHT=690,WIDTH=800 ,')">Blah page</A>

It prevents users even having the choice - this 'link' will either open
in a new window under the programmers control, or not at all. If a
user attempts to open it in a tab or new window, they'll perhaps get an
error message, or more likely nothing at all will happen.

--
Fred
Jul 23 '05 #3

P: n/a
"Mick White" <mw***********@rochester.rr.com> wrote in message
news:Hk*******************@twister.nyroc.rr.com...
David Hayes wrote:
I like availWidth and availHeight, but I'd much rather work with
window.availWidth and window.availHeight. Unfortunately, they just aren't universally available. When I ran a function to see which ones were


Window size != screen size.
Mick


I know that window size doesn't equal screen size. What I would like would
be to set the design of the inner space of the browser on the basis of the
window size. If I could, the new window (or the new page within the same
window) would be the same dimensions as the window that the user already is
looking at. This would satisfy the user who has determined how much of his
screen he wants to allot to the browser and doesn't care to see the link
take him to a page that uses a larger or smaller portion of the desktop.

--
David Hayes

(remove the name of the programming language from email address to make it
usable)
Jul 23 '05 #4

P: n/a
David Hayes wrote:
"Mick White" <mw***********@rochester.rr.com> wrote in message

Window size != screen size.
Mick

I know that window size doesn't equal screen size. What I would like would
be to set the design of the inner space of the browser on the basis of the
window size. If I could, the new window (or the new page within the same
window) would be the same dimensions as the window that the user already is
looking at.


This is default behaviour, no need for js to manipulate new window.
Mick

....snip
Jul 23 '05 #5

P: n/a
"Mick White" <mw***********@rochester.rr.com> wrote in message
news:2c*******************@twister.nyroc.rr.com...
David Hayes wrote:
[...]
I know that window size doesn't equal screen size. What I would like would be to set the design of the inner space of the browser on the basis of the window size. If I could, the new window (or the new page within the same window) would be the same dimensions as the window that the user already is looking at.


This is default behaviour, no need for js to manipulate new window.


There's no need to manipulate JavaScript to establish that the new window
will be the same size as the previous -- BUT THERE would be a benefit to
using the browser window's actual width (as opposed to screen width) to
position images mid-screen, set graphics to appear directly above columns
set to fill particular dimensions, etc. Sure, tables are wonderful to
positioning things at particular percentages and a given number of pixels,
but sometimes this is not enough. The context in which the desire of mine
was first mentioned, that being in the first message on this thread --
wherein I spoke before about tables and screen locations, and quoted from
another person who wrote on this subject in this newsgroup -- should suggest
the scope which should be considered when one responds with a rejoinder,
piece of advice, recommendation or suggestion that the person seeking a
JavaScript doesn't know enough about defaults outside of JS.

--
David Hayes

(remove the name of the programming language from email address to make it
usable)

Jul 23 '05 #6

P: n/a
David Hayes wrote:

There's no need to manipulate JavaScript to establish that the new window
will be the same size as the previous -- BUT THERE would be a benefit to
using the browser window's actual width (as opposed to screen width) to
position images mid-screen, set graphics to appear directly above columns
set to fill particular dimensions, etc. Sure, tables are wonderful to
positioning things at particular percentages and a given number of pixels,
but sometimes this is not enough. The context in which the desire of mine
was first mentioned, that being in the first message on this thread --
wherein I spoke before about tables and screen locations, and quoted from
another person who wrote on this subject in this newsgroup -- should suggest
the scope which should be considered when one responds with a rejoinder,
piece of advice, recommendation or suggestion that the person seeking a
JavaScript doesn't know enough about defaults outside of JS.

var windowWidth= window.innerWidth?window.innerWidth:
document.clientWidth?document.clientWidth:"unknown "

Note that IE determines window size after all content is loaded. And I'm
not 100% sure of references.

Mick
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.