...

View Full Version : exact window size problems with Netscape7



Jorn
04-03-2003, 08:07 PM
I have scripted specifically sized windows without resize, location,scroll,tools and menu to display sequences of Flash movies. This works fine in IE and earlier Netscapes.

In Netscape7 and Mozilla however, the windows are somewhat shorter and don't display the complete movie.

Why is that and is there a remedy?

--

I also wondered whether there is a way of scripting away the new tabs in the Netscape7 browser?

thanks

Jorn

jkd
04-03-2003, 08:34 PM
call the sizeToContent() method of the window and let the browser do it for you automatically.

brothercake
04-03-2003, 08:40 PM
I was about to post saying sizeToContent doesn't seem to work, then I remembered I have my JS preferences set not to allow sites to resize windows.

It might be worth remembering that - that you can't absolutely rely on it.

Jorn
04-04-2003, 05:42 PM
thanks for your suggestion.

do you know why this is happening?

j

brothercake
04-04-2003, 07:27 PM
You're seeing this with ns7 in tabbed browser mode, yes? Well the tabs themselves take space away from the inner canvas, but (afaics) don't report to the JS interpretor how much space has been used.

When you open a window with specific dimensions, the numbers are the internal dimensions of the window; but, you may not actually have all that canvas, because of the tabs.

The best solution, I think, is to attach less importance to the size of the window - give yourself margins to play with, or better yet, allow the window content itself to be flexible and take up as much or as little space as it has.

Jorn
04-05-2003, 02:55 PM
even without tabbed browsing do NS7/Mozilla display the windows somewhat 40-60 pixels shorter. it is basically cutting off the bottom. that may well be the height of the tabs.

strangely though, the first window seems to be opening in the exact size. only the sequence following is not doing it. probably need to place resize commands everywhere.

thanks anyway

j

brothercake
04-05-2003, 04:17 PM
When you open a window with specific dimensions, the numbers are the internal dimensions of the window

But when you resize an already-open window, the figures are the outer dimensions - the difference is the browser's chrome (toolbars, window borders etc)


There is a way to calculate the chrome size though - in netscape you have the outerWidth and outerHeight properties; you can work out the chrome by calculating the difference between the inner / outer dimesnions. Or in IE can you do it like this:

- open a window at 100 x 100
- resize to 100 x 100
- work out the document dimensions with document.body.offsetWidth/Height
- the difference is the chrome size :)

liorean
04-05-2003, 04:33 PM
document.body won't give correct values in standards mode, though. Then you have to use documentElement instead of body.

Jorn
04-07-2003, 02:13 PM
thanks for the resize suggestions.

the size to content method doesn't work. the window opens in a very huge format.

the resize worked nicely with Mozilla but messed up the IE. it there a command that is directed at Mozilla/NS7 browsers only?

jorn

brothercake
04-07-2003, 11:40 PM
I have a client sniffer that might be useful to you - http://www.brothercake.com/scripts/sniffer.php

Jorn
04-10-2003, 03:50 PM
thanks for the link

I played around with your script and shortened it like this

if(navigator.userAgent.indexOf("netscape/7")==-1||navigator.userAgent.indexOf("netscape7")==-1){
window.resizeTo(270,181);
}else{
window.resizeTo(270,171);

NS7 likes it, but the "else" browser IE doesn't. IE follows the first resize too.

then tried variation:
if(navigator.userAgent.indexOf("netscape/7")!=-1, etc.
but that doesn't make a difference

what do I do wrong?

brothercake
04-10-2003, 03:56 PM
Your first condition says "if the UA string doesn't contain netscape7 or /7"; that's why IE executed it. But the != condition won't match netscape 7 either because you're looking for "netscape" in a UA string containing "Netscape" (the capital N is the difference).

Do this instead:

var agt = navigator.userAgent.toLowerCase();

if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1) { ...


But I still advise against this whole plan - the reason for wanting to discriminate is so you can resize to allow for netscape 7's tabs - but most other browsers either have, or can be extended to have tabs; and netscape 7 users may not have the tabs turned on. I really think you're better not trying to force the window to be the size of your content - but instead, allow your content to be the size of the window.

Jorn
04-10-2003, 04:28 PM
it seems that NS7 doesn't read the script. which ever way i put it it doesn't react. now IE behaves as it should but NS7 is back to chopping the bottom of the window.

unfortunately, the movies and images are sized and positioned on the screen in precise relation to each other. they are an art piece, in which flash movie narratives move from one window screen to another. in another section photographs are diplayed in windows, and I just don't want borders as it just looks better (and particularly good on Mac OSX). Hence my reluctance to make all again, only because of netscape 7. the whole structure is based on these individual windows, are there are plenty of them.

however, what puzzles me is that NS7 doesn't want to read the javascript commands...

brothercake
04-10-2003, 07:56 PM
can you post a link then, so we can see what happens.

Jorn
04-10-2003, 09:14 PM
took it offline for the moment.

but check www.leifcodices.info/anfang.html. that was the index.

j

brothercake
04-11-2003, 10:56 AM
What am I looking for? All I see is four links on the homepage that don't do anything.

Jorn
04-11-2003, 11:58 AM
I put it back online to http://www.leifcodices.info

you will get homepage: click on title: opens window titled library, then two other windows appear, titled exit + landscape. click arrows to take you into new sections, click exit to exit. mind you, on Windows, the exit window doesn't show, it seems - working to mend that problem. click 'landscape' arrow to trigger sequence of flash movies which open in new windows.

arrows and exit circle, etc are flash movies. needs flash 5 plug in. they have getURL commands to trigger the external javascript.

I am a Mac user: IE works fine displaying, NS4.7 asks whether the homepage window should be shut, NS6 works fine, NS7 cuts off bottom. I have not tested NS on Windows as I cannot install it on the machines available to me. IE on Windows works fine in relation to window size (but mucks about with the opening of exit window, but that's a different problem).

thanks

Jorn

brothercake
04-11-2003, 09:38 PM
Well that's weird - I tried your page in win/IE6 and win/NS7 and I see the same as you - the windows are not tall enough in ns7.

But when I recreate the basic thing myself, it works just fine. See if my code tallies with what you're doing. The window opener went like this:


window.onload = function()
{

var newWin = open("newwin.html","newWin","width=200,height=200");

}

Then in that page it went like this:


window.onload = function()
{

var agt = navigator.userAgent.toLowerCase();
if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1)
{
window.resizeTo(270,181);
}
else
{
window.resizeTo(270,171);
}

}

And they came out almost exactly the same - ns7 being a few pixels taller.

Does that help any?

Jorn
04-15-2003, 01:39 PM
i put your script into the file.

I left an alternative index page, that leads to opening three alternative windows. the 'landscape' titled one, includes your script.

as you will see in NS7, the browser now diplays the window more or less in the height it was meant to. However, if you look at it in IE now, you'll see that the window in far longer than before. ie, it also follows the script which is meant to be for netscape7 only...

http://www.leifcodices.info/alternindex.html

this is really strange....

j



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum