How can I fool a site that looks at the JavaScript object 'navigator' to see that I'm not on Windows?

后端 未结 6 1118
广开言路
广开言路 2020-12-06 00:04

I am trying to browse a website, however, it only works under Windows and Mac because they use the navigator.platform from JavaScript to find out the architectu

6条回答
  •  遥遥无期
    2020-12-06 01:02

    Provided that the browser you're using supports Object.defineProperty() (it likely does), a more modern way of achieving the same goal is as follows:

    Object.defineProperty(navigator, 'platform', {
      value: 'my custom value',
      configurable: true // necessary to change value more than once
    });
    

    This allows you to set it to any custom value you want, and it also allows you to change it as many times as you want without needing to reload the page.

提交回复
热议问题