[H-GEN] need some html/javascript pointers (setting window attributes)

Tony Nugent tony at linuxworks.com.au
Fri Jan 6 01:00:23 EST 2006


Hi folks!  This one is for all you web-development groupies out there.

 

(First off: apologies for using outlook for doing this email, and in html
format. it is a bit of an accident that outlook has become my mailer at the
moment.  But it does the job for now, I'll likely change back to doing it on a
linux box at some later time).

 

I'm writing some web pages for what will become part of my new website, and I'm
trying to solve a problem that I am having with them.

 

The scenario:

 

I'm using an ordinary html form to open a new browser window, by specifying a
TARGET='results' directive in the <form> element.

 

What happens when you click on the submit button (and with all browsers I've
tested it with so far), is that a new browser window is opened (once popups are
enabled in more recent versions of msIE) with a page displaying the results of
the form submission.

 

That is as expected and what I want to happen, so all well and good so far.  The
idea here is to have both browser windows opened side by side, so that the form
page is still there to be re-used with different options to update the results
window on demand.  It works like that quite nicely already.  For example, I have
one page with some thumbnail graphics embedded into a form, with the 'results'
window showing enlarged versions of the graphic - making it easy to look through
and choose what you want to look at and how you want it to look.  Another page
allows you to choose dates and other parameters that are associated with some
data, clicking on the submit button always shows the results in the same (named)
window.

 

But what I want to happen when the new window opens, is to have just the page
contents appear within it, with none of the other browser crud like the
location, menu, personal, and status bars and so on - I just want it to be a
plain browser window containing nothing but the output from the results of the
form submissions.

 

It is obviously (at least to me) a problem for solving with javascript.

 

I have tried to do it by using some simple javascript code that is supposed to
turn off the visibility of these browser items, run either in the initial <head>
area, or as a function call to an onLoad parameter in the <body> tag, but always
without the desired results - the clutter-bars stubbornly remain there.

 

If I use a js window.open(.) command in a test page, I can get want I want with
creating the new window (bare with nothing but the content and no bars within it
at all), but opening yet another browser window in that manner is an awkward and
ugly way to do it in this particular situation - I don't want to clutter the
place with browser windows, and I don't really want to write screeds of
complicated code just to achieve what I want.

 

Surely it should be possible to do some simple javascript (or other) magic get
the target window to turn off these various menu/info bars when the page loads!
??  You'd think so, but I just can't seem to get it to happen like that.

 

What I do have working are calls to window.resizeTo(x,y) and self.focus() doing
as I want when the page loads, but even then it is a pain because different
browsers interpret the (x,y) dimensions as either the outer or inner width and
height of the window (depending on the browser).  And attempting to find window
dimensions by looking for the window.innerHeight, .innerWidth, .outerHeight and
.outerWidth properties is unreliable because some browsers (notably m$IE) don't
define these at all (at least not like that).

 

The whole thing is a real PITA headache, especially with having to deal with the
differing behaviours of all the various the web browsers out there.

 

Is there a simple (or even a more complex) solution that will achieve what I
want to do?

 

I've looked at my text books, I've tried google'ing and there is a lot of good
info out there, but I've found nothing that specifically describes or does what
I want - which is to re-set the browser window properties at the time when the
page content is loaded, to disable (or perhaps re-enable) all these annoying and
unnecessary browser bars.

 

 

Just as an aside, about this website (for those who may be interested in what
I'm doing and how I'm doing it):

 

I'm developing this web site on a linux-based web server (it happens to be a
stock Fedora Core 4 install with most of its updates) running as a virtual
machine inside a VMWare box (see www.vmware.com <http://www.vmware.com/> ) on a
nice fast laptop running windows (XP).  It's a brilliant development platform,
especially for what I'm doing with it (and vmware can do a hell of a lot more
than just what I'm using it for).  It is the best of both worlds, and great for
testing with different browsers and so on.  I also have a desktop (running SUSE
9.something) with XP and win98/2k installed inside vmware virtual machines on
that box, and it all works just fine that way too (although I've tended to
favour using my laptop to do most of the actual development work).

 

The web site itself is rather ego-centric (unashamedly so), as the content will
reflect my self, my family (with a big section devoted to my father who took a
camera with him when he went off to war in Tobruk and the middle east, and also
to Japan after the war - some of the photos he took are amazing, especially of
the Tobruk siege experience and of the devastation of Hiroshima and Nagasaki
soon after they dropped the bombs), along with areas for my own various hobbies
and interests (including resources I've collected for linux and web
development).  My motives for doing it are mostly because I can, and because I
want it to be a showcase of the sorts of things I'm capable of doing.  Recent
illness has meant that I've lost work, and it is one of these rare moments in
life with things in reverse: no money but more spare time than usual - so I'm
putting my recovery period into some productive use with a project that I've
dreamed of doing for years.  Hopefully one spin-off will be that it will help to
get me working (and earning) once again.

 

The whole site just about 100% driven by php scripting to produce the final
html, and I'm finding this to be a very powerful platform for doing some very
cleaver and totally amazing things with the web pages (and the graphics) it
produces. I've been using the php (in some parts of the site) with a mysql
back-end (which is magical in itself), and I recently discovered to my delight
that php can also create and/or manipulate images dynamically on-demand to get
all sorts of way-cool results.  I'm really starting to put all that power to
some very good use.  It's a big (and yet another) learning curve (and getting it
all working and looking right takes a fair bit of experimentation and time), but
the results are just fantastic.  For example: on the server I'm generating some
rather large amounts of tabular data (dynamically by php itself and from the
grunged output of externally-run programs, and also with data pulled from
databases), and then manipulating and transforming it all into nice-looking
easy-to-analyse tables and graphical charts, with all the curves/bumps etc in
the chart graphics being generated dynamically by the php scripting using the
data.  The results are simply stunning, better than I ever imagined.  (And it's
fast too - generating these sometimes very complex graphical charts hardly seems
to register on the web server's system load and memory resources whenever it
does them).  Fun stuff, very pleasing to get it happening.

 

Many thanks for any help in solving this javascript problem I'm having with the
browser behaviour.

 

Cheers

Tony Nugent

Home: +61 7 5526 8020

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20060106/20e202e6/attachment.html>


More information about the General mailing list