3 ms·
I'm aware of another, similar trick: var i=new Image(); i.onload=i.onerror=fn; i.src='about:blank'; It's faster than setTimeout, and it's more com
by geocar 17y ago
I'm aware of another, similar trick:
var i=new Image();
i.onload=i.onerror=fn;
i.src='about:blank';
It's faster than setTimeout, and it's more compatible than postMessage.
- TrevorBurnham 17y agoInteresting. Is this in production use anywhere?
- geocar 17y agoThe biggest impetus is MSIE's early onload bug, so while this trick supports more browsers, it still doesn't support the one you want it to. I hacked up David Baron's demonstration so you can see it for yourself: http://geocar.sdf1.org/zero-timeout.html http://geocar.sdf1.org/zero-timeout.html