title: Using electron to access cross-origin-resources
body: <p>I have a list on sharepoint where I am tracking tasks.</p>
  
  <p>I am trying to create an electron app that will ping (http get request) this list every minute or so and display a little window with all the tasks the current user has assigned and highlight new tasks. </p>
  
  <p>I am using the fetch API to access the list as follows:</p>
  
  <pre><code>const _COLLAB_ROOT = "http://company.com/projects/team-site/_vti_bin/listdata.svc/"
  
  export function read(list, callback) {
      const myHeaders = new Headers({
          "Accept": "application/json",
          'Authorization': 'Basic '+btoa('username:password'),
          'Access-Control-Allow-Origin': '*'
      });
      const myInit = {
          method: 'GET',
          headers: myHeaders,
          mode: 'no-cors'
      }
      fetch(_COLLAB_ROOT+list,myInit)
          .then(response =&gt; {
              if (response.ok) {
                  response.json().then(data =&gt; {
                      callback(data.d);
                  });
              }
              return Promise.reject(Error('error'))
          }).catch(error =&gt; {
              return Promise.reject(Error(error.message))
          })
  }
  </code></pre>
  
  <p>Other module:</p>
  
  <pre><code>read('listname',data =&gt; {
    console.log(data);
  })
  </code></pre>
  
  <p>However when I send this request with  a list name filled in, I get the following:
  <a href="https://i.stack.imgur.com/kOT8v.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kOT8v.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/QK2i7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QK2i7.png" alt="enter image description here"></a></p>
  
  <p>Now I assume this has something to do with CORS. What I would like to know is, is there a way to get this working?</p>
  
  <p>It seems like something very obvious to be required in electron.</p>
  
  <p>Also I have set the we-preferences property to </p>
  
  <pre><code>mainWindow = new BrowserWindow({
      width: 800,
      height: 600,
      frame: true,
      'web-preferences': {'web-security': false}
    });
  </code></pre>
  
  <p>Any help is appreciated here.
  I will be really surprised if this is not possible so hopefully I am being dumb!</p>
  
  <p>Edit: Response when querying from Restlet client on chrome<a href="https://i.stack.imgur.com/GF3d3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GF3d3.png" alt="enter image description here"></a></p>