Why does Chrome resolve websitename.localhost as localhost?
From https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/
There's a proposal to add the .localhost domain as a new standard, which will make lives of developers way easier. It would mean site.localhost and everything at *.localhost would automatically translate to 127.0.0.1, without /etc/hosts or dnsmasq workarounds.
Refer the RFC here.
From the Wikipedia entry for .localhost (TLD):
As a top-level domain, the name has traditionally been defined statically in host DNS implementations with address records (A and AAAA) pointing to the same loopback addresses.
However, as you have found, it would appear that it's just Chrome and later versions of Opera (possibly the WebKit browsers, so might include Safari also) that appear to do this.