0

I am trying to code small javascript bot that works on my chrome developer console.It involves grabbing few external links.But I get the following error

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'domain.com' is therefore not allowed access.

I know its not possible to load like this via php script or via website.I just want to know if we can change origins or disable this in chrome developer console so I can test for myself in my computer.I tried below code

var ajaxResponse;
$.ajax({
    type:'GET',
    url:'http://somedomain.com',
    headers:{
            'origin': 'https://somedomain.com'
    },
    success: function(response){
        ajaxResponse = response;
    }
});

I just wanna know how to disable this in only in my chrome browser.

Vishnu
  • 2,372
  • 6
  • 36
  • 58
  • You cannot add header to the server, period. You can send that header all day, but unless it's on the server, the result will not change. It's a security issue. Look into CORS. https://staticapps.org/articles/cross-domain-requests-with-cors/ Regarding testing locally, you would have to update the headers on the server. Just add one for `Access-Control-Allow-Origin` with the value of `*` – Jacques ジャック Jan 10 '16 at 05:04
  • But my question is , samething works if i just visit somedomain.com and paste that code in console...I just wanna create something like my own javascript browser.. – Vishnu Jan 10 '16 at 05:12

0 Answers0