2

I'm trying to change window.navigator. But for some reason can't change it:

--
[10:40:28.802] window.navigator['buildID'];
[10:40:28.811] "20121129162756"
--
[10:40:47.225] window.navigator['appCodeName'] = "I want to change it";
[10:40:47.234] "I want to change it"
--
[10:40:55.633] window.navigator['appCodeName'];
[10:40:55.643] "Mozilla"
--
[10:41:02.405] window.navigator['myProperty'] = 'someproperty';
[10:41:02.414] "someproperty"
--
[10:41:07.651] window.navigator['myProperty'];
[10:41:07.660] "someproperty"

Hope my question is clear: 'How to change window.navigator?'

Vor
  • 30,519
  • 41
  • 129
  • 188
  • Are you trying to punish browser sniffing? – Asad Saeeduddin Jan 02 '13 at 15:49
  • Already have an answer here: https://stackoverflow.com/questions/38808968/change-navigator-platform-on-chrome-firefox-or-ie-to-test-os-detection-code – ospider Aug 06 '20 at 06:38
  • Does this answer your question? [Change navigator.platform on Chrome, Firefox, or IE to test OS detection code](https://stackoverflow.com/questions/38808968/change-navigator-platform-on-chrome-firefox-or-ie-to-test-os-detection-code) – ospider Aug 06 '20 at 06:38

1 Answers1

5

You can't. Its pre-existing properties are read-only. Why you would want to modify it is beyond me...

Niet the Dark Absol
  • 311,322
  • 76
  • 447
  • 566