{"action":"opened","issue":{"url":"https://api.github.com/repos/atom/electron/issues/3539","labels_url":"https://api.github.com/repos/atom/electron/issues/3539/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/3539/comments","events_url":"https://api.github.com/repos/atom/electron/issues/3539/events","html_url":"https://github.com/atom/electron/issues/3539","id":118188486,"number":3539,"title":"Set HTTP referer header with jQuery","user":{"login":"suminb","id":136119,"avatar_url":"https://avatars.githubusercontent.com/u/136119?v=3","gravatar_id":"","url":"https://api.github.com/users/suminb","html_url":"https://github.com/suminb","followers_url":"https://api.github.com/users/suminb/followers","following_url":"https://api.github.com/users/suminb/following{/other_user}","gists_url":"https://api.github.com/users/suminb/gists{/gist_id}","starred_url":"https://api.github.com/users/suminb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suminb/subscriptions","organizations_url":"https://api.github.com/users/suminb/orgs","repos_url":"https://api.github.com/users/suminb/repos","events_url":"https://api.github.com/users/suminb/events{/privacy}","received_events_url":"https://api.github.com/users/suminb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-21T10:39:19Z","updated_at":"2015-11-21T10:39:19Z","closed_at":null,"body":"This might sound like a stupid question, but would it be possible to manually set the HTTP referer header via jQuery? What I'm trying to do is something like this:\r\n\r\n    $.ajax({\r\n      url: 'http://localhost:8080',\r\n      headers: {\r\n        'Referer': 'http://non-local-host'\r\n      },\r\n      data: {},\r\n      type: 'POST',\r\n      success: function(response) { console.log(response); }\r\n    });\r\n\r\nThen I get this error message:\r\n\r\n    Refused to set unsafe header \"Referer\"\r\n\r\nThe origin of this error message is somewhere in the middle of the jQuery code.\r\n\r\n    // Set headers\r\n    for ( i in headers ) {\r\n      xhr.setRequestHeader( i, headers[ i ] );\r\n    }\r\n\r\nI assumed this is happening because of the security policy of WebKit, so I tried to disable the `web-security` option but it did not make any difference.\r\n\r\n    mainWindow = new BrowserWindow({\r\n      width: 800, height: 600,\r\n      'web-preferences': {'web-security': false}\r\n    });\r\n\r\nAny help would be greatly appreciated."}}