Javascript delete navigator object
As of now in Chrome, window.navigator and apis exposed via window.navigator seem to be read-only and simply calling delete
on them won't have any effect.
For testing purposes I've been using Object.defineProperty
to define a getter that returns null. this works well when a script or polyfill on the page tries to test for the existance of a specific browser api:
Object.defineProperty(window, 'navigator', {
get() {
return null;
},
});