Default WebSocket URL to localhost when served from file://

Convenient when developing. Also, before this change the WS URL
setting UI would not showing up, making it hard to customize the URL.