Access to Script at ' from origin 'null' has been blocked by CORS policy

后端 未结 2 1582
孤城傲影
孤城傲影 2020-12-30 19:31

So when I am trying to import class from another javascript file, I am getting error in console like this:

Access to Script at \'file:///home/../.../JavaScri         


        
2条回答
  •  感动是毒
    2020-12-30 20:16

    file:// requests will not work, but you can run a local webserver (polymer serve, express, etc.) to use HTTP requests instead. You could even use the following Chrome extension to run a local webserver.

    https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en

提交回复
热议问题