Multiple getURL Calls May Cause Link to Fail in IE

A coworker of mine recently stumbled across a weird occurrence where a getURL link worked in Firefox but not IE. I have to admit, I thought he was crazy at first but I saw the odd behavior replicated on several different machines, including my own. The statement was not complicated. It was a straight URL to _self, something like this: getURL(“http://www.google.com”,”_self”); . The only thing out of the ordinary was that it was followed up with another getURL which was a javascript call which sent link tracking information.

Turns out that Internet Explorer calls getURL() asynchronously. This means if you try to call multiple getURLs in rapid succession, it’s possible that only one of them will be executed.

There are a few possible solutions:

  1. Sometimes it’s possible to get around the problem by re-ordering the getURLs (though I have no explanation for that one).
  2. Use Sean Rooney’s custom GetURLQueue class technique.
  3. String the calls together into one js getURL call, like this:

getURL("javascript:location.href='http://www.google.com';javascript:doSomethingElse();");

I found that the third option addressed the issue nicely and was the easiest to implement for our purposes.

-rG

6 thoughts on “Multiple getURL Calls May Cause Link to Fail in IE

  1. I ran into this same issue recently. I basically added a delay into the source. We were firing tracking JS calls on links and the tracking calls were getting lost. I simply added in an interval that waits half a second after it fires the tracking JS and then opens the requested URL. It resolved all of the issues we had.

  2. Holy smokes!!! Thank you!!! I’ve been pissing with this for more than a week. What a PITA! IE sucks big time. BTW, before finding this post, I was having the same issue in IE 7 as well. Evidently it hasn’t been fixed yet.

  3. @Ivan: It’s not a case of finding the correct command to use. It’s a case of finding a way around IE’s asynchronous communication method. A lot has to do with the timing of the calls.

    Glenn

Comments are closed.