what caused onresize event behavior to change?

J

jerars

Hi!

I have recently realized that some computer in my office have a
different behavior when it comes to handle the onresize event in
Internet explorer. I red a lot on this forum about this but I never was
able to understand what is the cause of the different behavior. That's
what I want to know.

my HTML code:
-----------------
<html>
<head>
</head>
<body onresize="alert()">
</body>
</html>
-----------------

a very simple code like this generate two very different behavior in
IE.

#1 - Most of the computer will do an alert as soon as I resize the
window for a single pixel.

#2 - the alert occurs at the end of the resizing when I release the
mouse button.


Anybody know what I can modify in my computer to have every copmuter
react as #1 situation??

Hint: I saw this problem on winxp sp2, win2000, win98. IE version
doesn't seems to make a difference. I tried to compare the windows
update... without success!
:(

Thanks for your help!

Jeje
 
V

VK

It is very strange that it work(ed) for you however whatsoever, because
it shouldn't.

Consider the small test case at the bottom. The comments are following:
1) Firefox fires 'onload' AFTER you ended up with resizing. It has
sense, because not any resize is really resize: what if you returned
the window to the exactly same size as before dragging? Take the resize
event on the capturing phase (while it's going down), and you are sort
of ok. BUT SEE THE POINT 3 !

2) IE 6.0 is badly broken. It generates from 2 up to 4 resize events AT
THE BEGINNING of each drag, depending from what side are you dragging
(it must be correlated to the scrollbars redraw, which causes separate
resize bubbles). Also it fails to set event properties (all undefined),
so you cannot trace bubbles history.

3) A huge lot of things may cause onresize event, including first page
load. So using this method you can easily fail in a dead loop, then one
onresize will cause another etc. etc. You should use real size check:

on init:
self.oldWidth = self.innerWidth
self.oldHeight=...

and later if self.oldWidth != self.innerWidth etc.


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script>
var isDOM = window.addEventListener;
function init() {
if (isDOM) {
self.addEventListener('resize',test,true);
}
else {
self.attachEvent('onresize',test);
}
}

function test(e) {
var tmp = '';
if (isDOM) {
alert(e.target);
}
else {
for (prop in event) {tmp+=prop+'='+event.prop+'\n';}
alert(tmp);
}
}

window.onload=init;
</script>
</head>

<body bgcolor="#FFFFFF">

<p>Text</p>
</body>
</html
 
J

Jim Ley

a very simple code like this generate two very different behavior in
IE.

#1 - Most of the computer will do an alert as soon as I resize the
window for a single pixel.

#2 - the alert occurs at the end of the resizing when I release the
mouse button.


Anybody know what I can modify in my computer to have every copmuter
react as #1 situation??

change the "show window contents whilst dragging" setting in your
window manager.

Jim.
 
V

VK

Just knocked on me:

"event properties for onresize are not set" might be not a bug, but a
security mesure. Otherwise we could bypass frame security model by
using event.srcElement.doWhatYouWant()
 
J

Jeje

Thanks for your help everybody!

VK:
My problem only concern IE 6 + on a window OS because I'm making a
software based on this technology (poor me! :)
My question is not how to go around the problem in an html page, but
what windows update, registry key, or whatever windows settings can be
turn ON/OFF to enabled or disabled this "feature".

Jim Ley:
Thats the kind of answer I was expecting. I hope what you say is true,
Unfortunatly I'm going to have to wait until tuesday to test this.

Here's what I found on this topic:

-------------------------------------------------------------
Showing window contents whilst dragging

This tweak turns on the option to show the full window contents (rather
than just an outline) of a window whilst it is being dragged to a new
position.
To show window contents whilst dragging:

Use a registry editing tool to navigate to the following key:
HKEY_CURRENT_USER\Control Panel\Desktop


Insert or change a value with the following details:
Data Type: SZ
Value Name: DragFullWindows
Value: 1


Restart the computer for the changes to take effect.
Please note: This functionality is automatically turned off by some
third-party applications
-------------------------------------------------------------
found on:
http://www.sanx.org/tipShow.asp?articleRef=143

Many thanks to everybody, I'm going to confirm soon if that is the
solution!

Jeje
 
J

Jeje

Confirmation!

the solution:

the registry key that turn that feature ON/OFF

HKEY_CURRENT_USER\Control Panel\Desktop\DragFullWindows

1=ON (will display the content while the window is moved or resized)
0=OFF(will not)

It seems this feature have an effect on the onresize event of an HTML
page.

Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top