How to override navigator property in electron app



Is there a way to override navigator property in electron app.
I want to spoof navigator.platform while accessing few website



IF you are using a single page app, you could try load a preload script which runs as follow

        configurable: false,
        writable: false,

But if you have reload, or navigate actions, you will need to find other methods.



Thanks for suggestion
preload is the only way to do this?I tried this and it is working
However it is difficult to randomize this attribute if we change platform in preload.js

For first hit I use win32 and next mac , linux etc.
Is there a way I can do that programmatically from render process?


just change writable: false to writable: true and you will be able to change its value in render process