[Vuejs]-Is there a way to "GET" a csv like information in a website using only Vue.js?

0👍

The error you are facing here comes from the fact the the server your are trying to get the file from does not allow CORS (Cross-Origin Resource Sharing).

Putting is simply, you site (e.g. running on http://localhost:3003/) is trying to access http://nestlegremio.ddns.net:8003/.

  • When a web browser tries to access a resource that doesn’t reside on
    the same domain (http://localhost:3003/), it does a first query to
    the web server with OPTIONS to get CORS info from the server.
  • If the server does not say CORS is enabled for this domain, then the
    browser won’t run the request and throw the error message you saw.

The solution here is:

  • If you have access to this given we server, is to allow CORS on it, if you want to rely only on client-side code.

  • If you don’t have access to the server, you will have to build some server code to retrieve your data from the given url, then to give it back to your Vue.js code. Http calls done from server-side code are not impacted by CORS.

Here is a more detailed explanation on this topic.

Leave a comment