Explanation:
The screenX, and screenY properties of the event corresponds to the the x and y coordinates of the mouse pointer's position relative to the user's screen respectively .
Now comes the juicy part ....
IE forces a mouse move whenever you change the focus of the window .So the interesting point to note is that - a mousemove event is forced even though the mouse co-ordinates dont actaully move ! So if you are able to track the previous mouse co-ords and catch the point where a mouse move is called - but at the same time the values dont change - bingo ! 8 )
var logs ,x=-1, y=-1 ,ctr = 2;
document.onmousemove = catchmaxmin;
function catchmaxmin(ev){
logs = document.getElementById('logs');
var e = (ev!=undefined)?ev:event;
if(e["screenX"]==x && e["screenY"]==y && ctr%2==0 ){
logs.innerHTML+= '
maximized /minimized ! ';
}
ctr++;
x = e["screenX"];
y = e["screenY"];
}
I've been looking for a similiar hack in firefox ,but i guess this useful bug has'nt been introduced into the Mozilla camp . 8 ) Here's a working demo ( tested on ie6 , ie7 ) of the 10 odd lines of code needed .
Keep Clicking,
Bhasker V Kode
Technorati Tags: javascript, event, maxmin, ie, window, bosky101, bhasker, kode, hack