[jQuery] How to detect if an iFrame's location (URL) has changed...

[jQuery] How to detect if an iFrame's location (URL) has changed...

Hi all.  I've been having a tough time detecting if an iframe on a page has changed.  My strategy has been to attach an onload event on the iframe to check if the location.href has changed from the previous.  This works great on Firefox, but not on IE.
Here's my current code:
            var iframeURL = frames['target-frame'].location.href; //this saves off the initial iFrame URL
            $(frames['target-frame']).load(function(){
                var currIframeURL = frames['target-frame'].location.href; //this is the new iFrame URL
                if (iframeURL != currIframeURL) {
                    alert(iframeURL +" " + currIframeURL);
                    iframeURL = currIframeURL; // saves off the new iFrame URL
                }
            });
The problem I'm having with IE is that if I execute the onload immediately, it gives me a security error when accessing frames['target-frame'].location... presumably because IE fires my onload before the document in the frame actually loads triggering a
document.domain security violation.  To get around it, I've set a timeout on the onload so that it doesn't execute right away, but this is not reliable because of latency issues, etc.  I thought about adding a callback in the documents in the iframe page, but I won't have control of that 100% of the time... so I need a solution that I can implement on the parent document.  Ideally, it would be nice if I can check an object in the frame to see if it's available, but IE thinks that the frame is already available at the time my onload fires.
Anyone know of a good solution to this?
Thanks!
Rich
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/