473,765 Members | 1,979 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.demo n.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.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Apr 17 '07 #1
7 2087
Dr J R Stockton said the following on 4/17/2007 2:20 PM:
I want page <URL:http://www.merlyn.demo n.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.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 18 '07 #2
In comp.lang.javas cript message <lc************ ********@gigane ws.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.demo n.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.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demo n.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.demo n.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(docume nt.forms.F.offs etWidth,documen t.forms.F.offse tHeight);docume nt.forms.F.X0.s crollIntoView()

Apr 21 '07 #4
Dr J R Stockton said the following on 4/19/2007 11:39 AM:
In comp.lang.javas cript message <lc************ ********@gigane ws.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.demo n.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 "dictatoria l" 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.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 21 '07 #5
In comp.lang.javas cript message <11************ **********@o5g2 000hsb.goo
glegroups.com>, Fri, 20 Apr 2007 21:25:31, scripts.contact
<sc************ *@gmail.compost ed:
>
Dr J R Stockton wrote:
>I want page <URL:http://www.merlyn.demo n.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(docum ent.forms.F.off setWidth,docume nt.forms.F.offs etHeight);do
cument.forms.F .X0.scrollIntoV iew()
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.demo n.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demo n.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demo n.co.uk/batfiles.htm- also batprogs.htm.
Apr 21 '07 #6
In comp.lang.javas cript message <qv************ ********@gigane ws.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.javas cript message <lc************ ********@gigane ws.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.demo n.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 "dictatoria l" 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.demo n.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.javas cript message <qv************ ********@gigane ws.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.javas cript message <lc************ ********@gigane ws.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.demo n.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 "dictatoria l" 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* "appropriat e" 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 "dictatoria l" 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
desiredCanvasHe ight and desiredCanvasWi dth. 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.javas cript 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
7793
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 (function(){this==window}, 100) I see true, the sad fact that 'this' is window and not an anim. What are some proper ways ? I would like to avoid
2
1857
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 question. Anyway... I have a simple javascript function that opens up a new window and writes HTML code in it to display an image (I don't just display the image because of problems with different margins in different browsers). Nothing exotic there. ...
2
3824
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 myWindow does not work with the mouse event, but it seems to work fine with a javascript: URL command. I would prefer to do it with the mouse event. Please assist. I can not find any documentation for this in any of my books.
7
1682
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
2140
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: <script>IncludeMenuHere()</script> More, any tips about "fading" the menu item in and out (x-browser)? Currently it's using DIVs and this.items.visibility(false);
8
2944
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: http://www.reloco.com.ar/mozilla/compat.html Bye! PS: I hope it's useful to someone. I would appreciate any comments and suggestions!
18
12699
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 state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
2
3390
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> In IE6, either mode, as the port shrinks to less than the width of the table, either through a small screen size or shrinking the browser window, the right edge of the div maintains its 10px padding with the
31
3542
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window? ----------------------------------------------------------------------- In a default security environment you are very limited in how much you can modify the current browser window. You can use ` window.resizeTo ` or ` window.moveTo ` to resize or move a window respectively, but that is it. Normally you can...
0
10160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2805
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.