Making window fit contents in all browsers?

D

Dr J R Stockton

I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htm> to open, in
IE6, IE7, Firefox 2, and wherever else practicable, with the control
labelled F.X0 fully visible at the top of the window and the control
F.Result (which is just under the textarea) fully visible at the bottom
of the window.

What's the right, or best, way to do that? It's right in IE6 at
present, and near enough so in FF2 if there's only a single tab. But
the "tab bar" spoils it in FF2 (and a little space is wasted in IE7).

I also want the width of the window to be just big enough for the layout
etc., but that's about right at present anyway, though FF2 gives wider
buttons than IE 4/6.


FYI : RegExp \s recognises character \u2029 in FF2 but not in IR6.
Therefore, a new js-quick.htm uses \u2302 instead. Paragraphs should
not contain houses.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
D

Dr J R Stockton

In comp.lang.javascript message said:
Dr J R Stockton said the following on 4/17/2007 2:20 PM:

Ask the user to resize the window. Otherwise it is anti-social behavior
at best. And, resizing windows can be explicitly disabled in Mozilla
based browsers.


Don't be dictatorial. If you had read the page, you would have realised
that it is primarily for my own use, and secondarily for others to copy
and adapt if they wish. If they don't like what it does, the remedy is
in their hands.

I use the page so often (locally) that it would really be convenient to
have it always set itself to show just what I want - which in any case
is what any regular user of a copy would want - and it's much easier to
remove such a feature than to add it.

Additional : in FF2, as well as the tabs encroaching on the target area,
I think the FIND bar also does so.


Subsequently : (BTW, forget about the house; it's gone)

In "Pack", I want any vertical whitespace (typically two or more
newlines) to be considered as a paragraph separator. In IE,
S = S.split(/(\s*\r?\n\s*){2,}/)
splits the input string S into an array of paragraphs. But in FF2, that
puts a runt paragraph in between each pair of proper ones, leading to
poor results. I could include code to strip runts, but I'd rather get a
better RegExp. Any ideas?

INFO : In a Firefox TextArea, newline seems to be just character 10; in
IE, it seems to be a pair 13,10. But AFAICS that should not matter.

Of course, I'd like it to work properly in all other browsers too.


BTW, I also auto-re-size my browser's Home Page (that's not my site's
Home Page); and in it I have links for other sizes..
 
S

scripts.contact

Dr said:
I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htm> to open, in
IE6, IE7, Firefox 2, and wherever else practicable, with the control
labelled F.X0 fully visible at the top of the window and the control
F.Result (which is just under the textarea) fully visible at the bottom
of the window.

see if this works onload-
resizeTo(document.forms.F.offsetWidth,document.forms.F.offsetHeight);document.forms.F.X0.scrollIntoView()
 
D

Dr J R Stockton

In comp.lang.javascript message said:
Dr J R Stockton said the following on 4/19/2007 11:39 AM:

Hmmm. Let me think this out here now. You want to force a browser
window size onto your users. Yet you call me "dictatorial" for telling
you it was a bad idea. Interesting line of thought you have sometimes.

If you had read the page,

Missing > - I wrote those six words.
You know, as well as anybody else here, that a Usenet post should stand
on its own merits without having to resort to reading a webpage in
order to understand a question you pose here, unless it states in your
post (which it didn't) that the question was further explained in the
page.

And, you might want to add "opened and " after the third word of that
sentence.

Undefined : "that".
Again, you are assuming - incorrectly - that I even opened the page,
much less read it. The onus is on you, as the OP, to explain your
question, it is not up to me to guess what your intentions are.

No : "If you had read the page," expresses a possibility but not an
expectation. It's the sort of thing that a reasonable person would do
before commenting about whether re-sizing and scrolling was appropriate
for the page in question.

But, in order to answer the question as I asked it, there was no real
need to visit the page, although that might have helped.

Of course, in the ordinary commercial environment, resizing larger is
arrogance and forces the ordinary reader to accept something unwanted.
Different considerations apply in a page which is not only part of a
javascript site but which is specifically aimed at those who are
currently active programmers - if they're not capable of amending a
local copy, they're in the wrong place anyway.
Yes, and it involves leaving the site and not returning.

If they wish, yes. It's primarily for my own use, both locally and
remotely. In fact, as I say on the page, I don't *want* people to use
it much, but to use a copy instead.
You seem to know, before asking, what anybody else wants, and you call
me dictatorial. Interesting.

Indeed, the design of the page is such that I do know what they will
want when visiting the page, unless they visited it in error. The rest
of the material on it is only for reference, and will be read
infrequently. If you had visited the page, you would have realised
that.
You know the canvas height and width you want it to display it.

No, I do not. I know the internal height of the textarea in characters,
and the width in percent, but I don't know the size of F in pixels. F
contains other controls.

ISTR seeing a Method for getting position; but I cannot recall what it
is.
What you do on your own PC is your own business. Trying to force a
browser window size on a web site is irresponsible behavior of a web
author. I am pretty sure Alan has said that before.

Do you mean the late Alan? Or one who posts here?
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
glegroups.com>, Fri, 20 Apr 2007 21:25:31, scripts.contact
see if this works onload-
resizeTo(document.forms.F.offsetWidth,document.forms.F.offsetHeight);do
cument.forms.F.X0.scrollIntoView()

The words "Scroll Into View" do not express what I want there; but
method .scrollIntoView actually does what I want. So far so good.

The textarea is set to width 99% (and other controls conform) so ISTM
better at present to leave the width code as is. I might try setting
the textarea to cols=72, then the page width to fit that, then the
textarea to 99%.

The height does not seem to work right in IE though it does in FF.

Still, there's been some progress; thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top