title: Greasemonkey Spoof User Agent
body: <p>In a website I visit, there is a bit of code that checks the User Agent and if it is not IE, it will redirect to another website.</p>
  
  <pre><code>if( ! window.navigator.appVersion.match(/MSIE ([0-9]+.)[A-Za-z0-9.]+;/) || new Number(parseFloat (RegExp.$1)) &lt; 5.5 ){
      window.location.replace("/iedownload.htm");
  }
  </code></pre>
  
  <p>Is there a way to make a quick greasemonkey script to spoof the User Agent? I tried</p>
  
  <pre><code>GM_xmlhttpRequest({
    method: 'GET',
    url: window.location.href,
    headers: {
      'User-Agent': 'Mozilla/4.0 (compatible; MSIE 9.0;) Greasemonkey',
      'Accept': '*/*',
    },
  });
  </code></pre>
  
  <p>But it did not work.</p>