title: Change navigator.platform on Chrome, Firefox, or IE to test OS detection code
body: <p>How can I spoof the value of navigator.platform on Chrome, Firefox, or Internet Explorer (preferably Chrome)?  It looks like it used to be possible on Firefox natively but that support was dropped for that.  </p>
  
  <p>This is to test some code on a site which runs in a conditional JavaScript check which tests the navigator.platform property.  Unfortunately it's not testing userAgent which would be easy to change.</p>
  
  <p>I tried writing a simple chrome extension per the suggestion in the second post on <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/8cCllrVX4kI" rel="noreferrer">https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/8cCllrVX4kI</a> but it doesn't work (I included the code I tried below).  If I do console.log(navigator.platform) in the extension, it prints out "MacIntel" as desired but if I type navigator.platform in the console after page load it says "Win32" (i.e. the actual OS which I'm not wanting it to say). </p>
  
  <pre><code>//navigator_change.js
  Object.defineProperty(navigator,"platform", {
    get: function () { return "MacIntel"; },
    set: function (a) {}
   });
  
  //manifest.json
  {
      "manifest_version": 2,
      "content_scripts": [ {
          "js":        [ "navigator_change.js" ],
          "matches":   [ "&lt;all_urls&gt;"],
          "run_at":    "document_start"
      } ],
      "converted_from_user_script": true,
      "description":  "Fake navigator.platform",
      "name":         "MacFaker",
      "version":      "1"
  }
  </code></pre>