in reply to Simple script not being executed when html page loads.

It's probably that the browser figures that it can't show an image of height=0 and width=0 so it doesn't bother trying to call the script. Try modifying the image tag so that it loads a 1x1 pixel transparent gif returned by your logging script.

Update: While you are developing the code you might want to work with a larger, visible image so that you can see whether script has run correctly.

You should be aware that some privacy tools remove 1x1 pixel images loaded from third party sites on the grounds that loading the image can be used for tracking the user without their consent.

  • Comment on Re: Simple script not being executed when html page loads.