2

I have gone through this question, but I am getting file not exists for the URL which definitely has content.

$.ajax({
    url: 'https://www.sec.gov/Archives/edgar/data/1550053/000168316816000505/grandperfecta_10k-073116.htm',
    type: 'HEAD',
    error: function() {
        alert('not exists');
    },
    success: function() {
        alert('exists'); //file exists
    }
});
}

Actual_Result: not exists

Expected_Result: exists

Community
  • 1
  • 1
John Adam
  • 29
  • 7
  • please refer this [link](http://stackoverflow.com/questions/3646914/how-do-i-check-if-file-exists-in-jquery-or-javascript) – Husen Nov 11 '16 at 13:49
  • 2
    JS cannot reliably make requests to third party domains due to the [Same Origin Policy](http://en.wikipedia.org/wiki/Same-origin_policy), so what you are trying to do here is flawed from the start. You would need to make a request to your local server and then have the server make the cross domain request for you (aka the proxy request pattern) – Rory McCrossan Nov 11 '16 at 13:51
  • You can also try to create an iframe (position:absolute; top:-9999px) and check the document load event – Arthur Nov 11 '16 at 13:58

0 Answers0