473,503 Members | 4,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making window fit contents in all browsers?

I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Apr 17 '07 #1
7 2053
Dr J R Stockton said the following on 4/17/2007 2:20 PM:
I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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?
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 18 '07 #2
In comp.lang.javascript message <lc********************@giganews.com>,
Wed, 18 Apr 2007 18:17:05, Randy Webb <Hi************@aol.composted:
>Dr J R Stockton said the following on 4/17/2007 2:20 PM:
>I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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?

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..

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demon.co.uk/clpb-faq.txt RAH Prins : c.l.p.b mFAQ;
<URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zipTimo Salmi's Turbo Pascal FAQ.
Apr 19 '07 #3

Dr J R Stockton wrote:
I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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.for ms.F.offsetHeight);document.forms.F.X0.scrollIntoV iew()

Apr 21 '07 #4
Dr J R Stockton said the following on 4/19/2007 11:39 AM:
In comp.lang.javascript message <lc********************@giganews.com>,
Wed, 18 Apr 2007 18:17:05, Randy Webb <Hi************@aol.composted:
>Dr J R Stockton said the following on 4/17/2007 2:20 PM:
>>I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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?
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.
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,

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.
you would have realised that it is primarily for my own use,
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.
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.
Yes, and it involves leaving the site and not returning.
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.
You seem to know, before asking, what anybody else wants, and you call
me dictatorial. Interesting.
Additional : in FF2, as well as the tabs encroaching on the target area,
I think the FIND bar also does so.
You need two events:
1) window.onload
2) window.onresize

Both will call the same function.

You need four dimensions:
1) window width
2) window height
3) canvas width
4) canvas height

You know the canvas height and width you want it to display it. You read
the current size, determine how much larger/smaller to make it to meet
your desires. Then you read the window width and height and resize
accordingly. The onresize is to handle the tabs changing the size of the
canvas area.
Subsequently : (BTW, forget about the house; it's gone)
The only thing gone are a few flowers the dogs dug up.
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..
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 21 '07 #5
In comp.lang.javascript message <11**********************@o5g2000hsb.goo
glegroups.com>, Fri, 20 Apr 2007 21:25:31, scripts.contact
<sc*************@gmail.composted:
>
Dr J R Stockton wrote:
>I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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.fo rms.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.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
Apr 21 '07 #6
In comp.lang.javascript message <qv********************@giganews.com>,
Sat, 21 Apr 2007 00:55:03, Randy Webb <Hi************@aol.composted:
>Dr J R Stockton said the following on 4/19/2007 11:39 AM:
>In comp.lang.javascript message <lc********************@giganews.com>,
Wed, 18 Apr 2007 18:17:05, Randy Webb <Hi************@aol.composted:
>>Dr J R Stockton said the following on 4/17/2007 2:20 PM:
I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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?
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.

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".
>you would have realised that it is primarily for my own use,

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.
>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.

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.
>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.

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.
>Additional : in FF2, as well as the tabs encroaching on the target area,
I think the FIND bar also does so.
>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?

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Apr 21 '07 #7
Dr J R Stockton said the following on 4/21/2007 5:53 PM:
In comp.lang.javascript message <qv********************@giganews.com>,
Sat, 21 Apr 2007 00:55:03, Randy Webb <Hi************@aol.composted:
>Dr J R Stockton said the following on 4/19/2007 11:39 AM:
>>In comp.lang.javascript message <lc********************@giganews.com>,
Wed, 18 Apr 2007 18:17:05, Randy Webb <Hi************@aol.composted:
Dr J R Stockton said the following on 4/17/2007 2:20 PM:
I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto 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?
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.
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".
"that" = The sentence that starts with "If you had read the page".
>>you would have realised that it is primarily for my own use,
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.
No, as it is *never* "appropriate" to resize a users browser window
without explicit permission and simply opening a page does not give that
permission.
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.
Precisely and I didn't open the page. Hence my suggestion to add "opened
and " to "that" sentence.
Of course, in the ordinary commercial environment, resizing larger is
arrogance and forces the ordinary reader to accept something unwanted.
Resizing at all, whether larger or smaller, is ignorant arrogance. Which
is what lead you to call me "dictatorial" yet now you are agreeing with
me. Interesting.
>>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.
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.
Again, what you say on the page itself is irrelevant as you have already
resized the browser, without permission, before a person even has a
change to read the page.
>>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.
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.
Are you a mind reader now? You must be if you can claim to know what a
visitor wants before visiting.
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.
Again, the content of the page is irrelevant to your question.
>>Additional : in FF2, as well as the tabs encroaching on the target area,
I think the FIND bar also does so.
>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.
Size the window the size you want it. Then, you read the canvas height
and width. Then you know F in pixels. FAQ 4.9 has code to determine the
canvas area. That canvas size will be fixed. Call them
desiredCanvasHeight and desiredCanvasWidth. Then, onload/onresize of the
page, you read the current canvasHeight and current canvasWidth.
Whatever the difference in the two sizes, you know you have to resize
the window by that many pixels. Then you read the window height/width
and resize it accordingly. Then it won't matter what toolbars/tabs or
anything else is showing, you get the canvas area you are after. The
onresize could be tricky as it may or may not get fired if tabs cause
the canvas area to be slightly smaller, you would have to test it.
>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?
The late Alan.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 22 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
7738
by: Richard A. DeVenezia | last post by:
At line this.timerId = setInterval (function(){this.step()}, 100) I get error dialog Error:Object doesn't support this property or method. If I change it to this.timerId = setInterval...
2
1836
by: Graham J | last post by:
Hello, Apologies for the somewhat wordy and garbled subject as I couldn't think how to phrase it and this has hindered my searching for any previous answers. It could be a really simple...
2
3808
by: Marc | last post by:
I am trying to create a new window from which the original page can close that new window. For some reason the following code will not work. Passing the window.open command to a variable called...
7
1661
by: Jonathan | last post by:
Hi I open a new window using a javascript function: function nw(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } which I call thus:
10
2097
by: Gernot Frisch | last post by:
Hi, I have found some menu functions. It works quite well, but how can I replace it with a simple <a href> if javascript is turned off? I reduced my code to:...
8
2906
by: Nicolás Lichtmaier | last post by:
Hi, some time ago I've written an article about this issue. It explain some differences in Explorer's and Mozilla's JavaScript/DOM. It has recently changed its URL, This is the new one: ...
18
12635
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
2
3368
by: Alan | last post by:
I am frequently doing something like the following: <div style="width:95%; padding:10px;margin:5px;"> <table>Contents include stuff that won't compress beyond a certain point.</table> </div> ...
31
3454
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window?...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.