On click event requireing redirection and an image to be displayed before redirect

I am not sure if the JS forum is the right place for this, but suspect the solution might be JS based.

I need to fire a 1x1 image when a user clicks on a link. I thought about the onclick event but the requirement has some tricky needs:

  1. The 1x1 should load (preferably fully) before the redirection happens - the redirection ideally being the src attribution of the anchor tag itself.

  2. The 1x1 should fire at the bottom of the page, not adjacent to the link clicked.

Is this possible?

Thanks - been a while since I got dirty and this has me stumped :slight_smile:

Yes it is possible. All you need to know is to identify the spot where the image is to be loaded. Set the redirect to fire once the image is loaded or certain time after the image has loaded using a timeout.

The first step is creating the 1x1 image, second is appending it to the end of the body, third is attaching an onload event (to navigate to the linked page), and last is to append the image to the page body.