How can we fake an Electron app's window URL (window.location)?

#1

F.e., I normally load my renderer process with

  mainWindow.loadURL('file:///path/to/index.html')

but I’d like for the application to see window.location.href as http://example.com, or similar.

How can I fake that, so that the app doesn’t know it is running on a file:// URL, but instead thinks it is on an http:// URL?

#2

Can we use webContents.session.setProxy for this?