views:

28

answers:

1

Hi. I've heard some rumors I can't seem te replicate. And now I'm curious if any of you have experiences with this issue.

Our analytics system uses JavaScript to generate an image of 1x1 pixels. This 'image' is registering all of our visitors behaviour.

Now consider the following (simplified) JavaScript code:

function visitLink (url)
{
  var randomNumber = Math.random();

  var img = new Image();
  img.src = 'http://www.example.com/log?url=' + escape(url) + '&' + randomNumber;

  window.open(link.href);

  return false;
}

Rumor says; window.open can block the background loading of img.src in some versions of FireFox.

It's working in my version of FireFox though. Am I seeing ghosts here? If not; any idea how to replicate the issue?

Erik

A: 

In my understanding JavaScript is a singlethreaded language and interprets from top to bottom of your function.

Therefore if something should be blocked, its the opening of the window and not the loading of the image. A quick repro of mine indeed shows this behaviour.

function visitLink (url)
    {
      var img = new Image();
      img.src = 'http://www.meshfields.com/' + url;

      document.getElementById("myImgId").src = img.src;      
      window.open("http://www.meshfields.com/index.html");
    }

Markup:

 <a href="javascript:visitLink('myBigPicture.jpg');">Link</a>

 <img id="myId" src="" />

All the browsers show no problems with loading of the pic. Tested on Safari, Chrome, Firefox, Opera on MacOSX. However I apparently did not use your inhouse analytics system to generate my pic.

Stephan Kristyn