huseyin tugrul buyukisik huseyin tugrul buyukisik - 1 year ago 63
Node.js Question

nodejs express detects google chrome's addressbar autocompleter while typing

I'm working on a serverside program using nodejs and express, it works as intended but, when I was typing(not even 2 characters of domain), server caught google chromes request(and sent response in return).

How can I stop my server program responding to google chromes requests while typing an address even at the beginning letter(it completes but doesn't enter, I hit enter always) but not when it is an actual request by user.

Does google chrome do this even for non-visited sites?

Is there a special request parameter to filter for this so I can pick only real client requests instead of browsers internal(but inbound to my server) requests?

While I'm writing something to addressbar such as "how can i ", it autocompletes with an (already visited) "query a collection"(probably requests from that site) and just over bottom there is (not visited) "love". Does google chrome do a http request to a non-visited-ever love suggestion site?

Google chrome ver: 54.0.2840.99 m (64-bit)

Maybe this is a normal behavior for browsers with some prefetch technology?

Answer Source

This is called as prerendering which loads a web page in the background before you finish typing the URL to speed up the page load performance.

It appears that this is undetectable in server side.

An issue was opened for this for the Chromium project. It's marked as "won't fix" (Prerendering does not have any distinguishing HTTP headers). The prefetch request doesn't show up in the Dev Tools "Network" tab, so you can't easily confirm this by look at the headers. When checked them using Wireshark, unfortunately there was no difference distinguishing pre-render requests from "normal" requests.

You can turn off this manually as below but unfortunately you can't differentiate with actual request in server side.

  1. On your computer, open Chrome.
  2. At the top right, click More More and then Settings.
  3. At the bottom, click Show advanced settings.
  4. In the "Privacy" section, uncheck the box next to "Use a prediction service to load pages more quickly."

SO Reference:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download