I am building a simple tool that tracks and increases the number of visits of a website. It's something simple as:
When the server receives a GET request, it will increase the counter in database for that website by 1.
However, I am running to a bit problem with Google Chrome's pre-render engine ("Predict network actions to improve page load performance").
The website is www.domain.com, and as soon as you type the domain name www.domain.com into the browser's address bar (without pressing Enter), Chrome sends a GET request to prefetch the page, resulting in the server logging that visit and increasing the counter in database by 1. After that, if the user presses Enter and actually loads the webpage, the server will see another GET request coming in, thus increasing the counter, again. This result in 2 duplicate visits logged in the database. As far as I understand, Google Chrome only downloads the page but doesn't execute it, but as soon as my server gets a GET requests, the counter is increased.
Question: Is there any way to work around this? Preferably, I would like to detect whether or not it is a prefetch or an actual user that visits the website.