[H-GEN] need some html/javascript pointers (setting window attributes)
Glenn Kentwell
humbug at kentwell.net
Fri Jan 6 01:16:55 EST 2006
Tony Nugent wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and ]
*sniip*
> 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.
*snip*
> 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.
>
Yep, this is the way everyone does it as far as I know. You have to
create the bare window using Javascript in the parent. You can't remove
the menu bars etc. after opening the window.
Didn't you say above that you're opening new windows anyway? You can
use the same window name in the Javascript window.open() function
multiple times to get the results to open in a single new window, if you
want, just the same as you do with a target="" attribute.
> 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.
>
There's no way that I know of.
>
> 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).
A friend of mine has an image gallery that opens a window and resizes it
to the image size after the image loads, maybe that's what you're
looking for? His site is http://www.gdaytiger.com
View the photo galleries, click to enlarge a pic and you'll see.
The only alternative I can think of is to use some DHTML. An DIV tag
with absolute CSS positioning can be made to show anywhere on the page
you want, and even dragged about by the user with some wacky javascript,
if you want that. When the user clicks an image you could make the DIV
visible, set an IMG tag's .src attribute inside the DIV tag and resize
it all to the dimensions of the image. Would be some work, but would
look cool.
Good luck!
Glenn
glenn at kentwell.net
More information about the General
mailing list