I am creating a simple tool that tracks and increases the number of visits to a website. This is something simple:
When the server receives a GET request, it will increment the counter in the database for this website by 1.
However, I ran into a small problem with the Google Chrome pre-rendering mechanism ("Predict network actions to improve page loading performance").
Website www.domain.com, and as soon as you enter the domain name www.domain.com in the address bar of the browser (without pressing Enter), Chrome sends a GET request to pre-select the page, resulting in a server that visits and increases the counter in the database by 1. After that, if the user presses Enter and actually loads the web page, the server will see another GET request, increasing the counter. This results in 2 repeat visits registered in the database. As far as I understand, Google Chrome only loads the page, but does not execute it, but as soon as my server receives GET requests, the counter increases.
Question : Is there a way around this? Preferably, I would like to determine if this is a prefetch or the actual user who visits the website.
source
share