I am currently working on a dev site and we edit hosts file since we do not want to make any changes to the live site however I need to copy some of the content from the original site to the dev site so I would like to switch between dev and live site without editing the hosts file every time
1 Answer
No.
The browser doesn't read the HOSTS file directly. The browser makes a DNS request to the OS and the OS returns a response (having checked the HOSTS file). So, it's the OS's DNS resolver you would need to override and I'm not aware of an easy override for that.
If manually editing the HOSTS file is too much work, then maybe some kind of script to automate this would be useful? However, you could still run into problems with the browser/OS caching the DNS, so flushing the DNS cache would need to be made part of this script.