Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of "(new Image()).src" in an onclick event?

This is the HTML for the main logo in the corner of the IMDb website.

<a onclick="(new Image()).src='/rg/home/navbar/images/b.gif?link=%2F%3Fref_%3Dnv_home';" href="/?ref_=nv_home" id="home_img" class="navbarSprite home" title="Home"></a>

I don't understand the onclick event. What is that doing? It doesn't make sense to me to see image instantiation as an onclick event for an image.

like image 221
temporary_user_name Avatar asked Nov 16 '25 20:11

temporary_user_name


1 Answers

It's a tracking click. Although it is creating an image, the sole purpose is to make an easy external request to the tracking URL to log the click (the image is never displayed on the page). b.gif is not really a GIF file, but a server-side tracking script.

like image 102
Joe Pietroni Avatar answered Nov 18 '25 10:11

Joe Pietroni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!