-1

I need to read the xls file content from URL with javascript and parse the content in html.

I used

/* set up XMLHttpRequest */
var url = "http://localhost/charts/test/file-test.xls";
var oReq = new XMLHttpRequest();
oReq.open("GET", url, true);
oReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 
oReq.setRequestHeader('Access-Control-Allow-Origin', 'http://localhost')

but cors error is detected

Access to XMLHttpRequest at 'http://localhost/charts/test/file-test.xls' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Any Help please :)

MMezlini
  • 161
  • 1
  • 14

1 Answers1

-1

cors is a safety mechanism in the browser as described in the documentation you can install a chrome extention to disable this temporarly or you can disable this in express

Arthur
  • 54
  • 4