G
Gérard Talbot
ASM wrote :
Right. If it already exists and if it uses the same parameters
Not reliable. Most alternative browsers now allow users to disable move
and resize script functions.
then store the parametrs in global variables between calls and compare
with current parameters. You then avoid all calls to moveTo, resizeTo.
E.g. the function OpenRequestedPopup(strUrl) which reuses and recycles a
single secondary window at this page:
http://www.gtalbot.org/BrowserBugsSection/MSIE6Bugs/
It also gives an example of scalable positioning of the window within
the available space for applications.
Why - 30? screen.availHeight already considers the height of the windows
task bar and the height of any semi-permanent os-dependent
applications (like MS-Office quick launch bar, MS-magnify, etc). The
window taskbar could be higher than 30 too. Some people (rare but it
happens) likes to have the window taskbar at the top. Personally, I like
having a 64px high window taskbar because I have many icons in the quick
launch bar.
Same here. screen.availWidth considers the width of any semi-permanent
os-dependent applications on the desktop. So, screen.availWidth is the
reliable width that a browser window can safely use. In some countries
where text is read from right to left, the window taskbar is on the left
side.
This instruction above seems suspicious...
resizeTo and moveTo can be neutralize in a large number of browsers
(Opera 7+, Mozilla-based).
Gérard
Gérard Talbot said:ASM wrote :
[snip]
(Following = something about popup focus)
Yes, you're right and I understand what you mean... but what if it
uses the same values?
I have to considere uses can be different from call to call
If not, width and height parameters have no sens
(no utility in function calls)
The thing is that the code makes no distinction, is not smart enough
to deal with such cases. One way is to store the href value, width and
height values in 3 global variables
A so usual and simple popup would really need more JS work with global
variables ?
and then to compare in the function. It's a bit more complicated. If
the webpage requirements are there, then this would be justified code.
I think popup focus in end of code would have to exist if there is a
possbility it allready does exists.
Right. If it already exists and if it uses the same parameters
In this case a window resizing would before hapen in the function.
Not reliable. Most alternative browsers now allow users to disable move
and resize script functions.
But it seems that some browsers don't resize windows ?
(in same way as others)
then store the parametrs in global variables between calls and compare
with current parameters. You then avoid all calls to moveTo, resizeTo.
E.g. the function OpenRequestedPopup(strUrl) which reuses and recycles a
single secondary window at this page:
http://www.gtalbot.org/BrowserBugsSection/MSIE6Bugs/
It also gives an example of scalable positioning of the window within
the available space for applications.
i.e
function pop(page,width,height) {
var margh = screen.availHeight? screen.availHeight : screen.height;
margh = (margh-height)/2-30;
Why - 30? screen.availHeight already considers the height of the windows
task bar and the height of any semi-permanent os-dependent
applications (like MS-Office quick launch bar, MS-magnify, etc). The
window taskbar could be higher than 30 too. Some people (rare but it
happens) likes to have the window taskbar at the top. Personally, I like
having a 64px high window taskbar because I have many icons in the quick
launch bar.
var margl = screen.availWidth? screen.availWidth : screen.width;
margl = (margl-width)/2-10;
Same here. screen.availWidth considers the width of any semi-permanent
os-dependent applications on the desktop. So, screen.availWidth is the
reliable width that a browser window can safely use. In some countries
where text is read from right to left, the window taskbar is on the left
side.
if(!(!truc) || !truc.closed) '';
This instruction above seems suspicious...
else truc = window.open('','','resizable=1,scrollbars=1');
with(truc) {
location.href = page;
resizeTo(width,height);
resizeTo and moveTo can be neutralize in a large number of browsers
(Opera 7+, Mozilla-based).
moveTo(margl,margh);
focus();
}
}
Gérard