Search code examples
javascriptgoogle-chromegoogle-chrome-extensionhtml5-filesystem

Can a Chrome Extension modify a user's host file?


Our Team Members frequently test and monitor a web application that we host on multiple servers.

Our environment is such that issues can be present on some servers but not others so we often need to test against multiple servers.

Currently, we facilitate this testing by manually changing entries in our hosts file so that we connect to a different server.

Our company hosts an enterprise Google Chrome extension that is available to and used only by our Team Members.

Is it possible for our Chrome extension to access and edit the hosts files for us?

The fileSystem looks promising but I cant find any information on it regarding this type of usage.

This will all be run in a trusted environment where we have access to control any registry entries that might need to be set to allow this type of access


Solution

  • It's possible only if you develop a simple native application that changes the hosts file according to requests from your extension coming through nativeMessaging API.