等待后设置window.location

I have a callback function that changes

window.location.href = url;

however, this callback is invoked after checking whether an image exists in a different page (and different domain). My problem is that IE9 won't let me do the following:

        $(testImage)
            .bind("load readystatechange", function (e) {
                if (this.complete || (this.readyState === 'complete' && e.type === 'readystatechange')) {
                    callbackFunction(true);
                }
            })
            .bind("error abort", function () {
                abort();
            })
            .attr("src", testUrl);

IE9 WILL however allow me to do this:

callbackFunction(true);

but as I want to wait and see that my image exists, I need the above to work. (I don't want to change IE settings) Of course, it all works just fine in Chrome.

Anyone got any ideas?

Edit: I think I should clarify: "when I say ie9 wont let me do.." I mean that ie9 executes the callback BUT the code inside (changing url) don't work.

IE also supports the load event on images, you don't have to explicitly check the .readyState property unless you have another reason you didn't mention.

So it should absolutely be enough to go like

$( testImage ).on('load', function( e ) {
    callbackFunction( true );
});