"kaeli" wrote
os***@ieee.org enlightened us with... In Javascript, how do I detect that the user has used the browser's menu
command to make the font smaller?
I don't think you can tell that.
Especially since a user can resize text by using the mouse, too. Mine is
set up to resize when I use control + middle mouse scroll.
All the known events do not cover this, which is a shame indeed, so you need
to constantly monitor the dimensions of a test element. A quick and dirty
example uses the setTimeout() method for that:
<script type="text/javascript">
var old, tid;
function checksize() {
var cur = document.getElementById('test').offsetWidth;
if( old && old !== cur ) {
alert( 'You just zoomed ' + ( old < cur ? 'in' : 'out' ) + '!' );
}
old = cur;
tid = setTimeout( ' checksize(); ', 50 );
}
window.onload = checksize;
</script>
</head><body>
<div id="test" style="position:absolute;left:-100px;">WWW</div>
In a quick test I learned if the page is in a frameset, IE does not update
offsetWidth's etc. until the window is resized, sigh.
hth
--
Ivo