Access to script at ‘file:///C:/Users/admin/Desktop/test/te.js’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
According to the contents of the translation:
from the origin of the "empty" has been blocked CORS strategy: cross-origin requests only supports protocol scheme: http, data, chrome, chrome-extension, https .
According to it will be seen: it is a cross-domain! ! !
Why is cross-domain?
- Because you are in the local open files, and file protocol does not support
- http, data, chrome, chrome-extension, https These protocols support cross-domain request
- And when you open a Web page directly in the position of a letter (script tag introduced a js file a place), then in the browser address bar showed the following: file: /// D: / MyStudyProject / JSTopLevel / chapter -9 / 2% E5% AF% BB% E6% 89% BE% E5% AD% 97% E7% AC% A6% E4% B8% B2% E9% 87% 8C% E5% B8% A6% E5% BC % 95% E5% 8F% B7% E7% 9A% 84% E5% AD% 97% E7% AC% A6% E4% B8% B2.html, cross-domain problem occurs. And http, https and other protocols to support cross-domain requests.
- So the solution is to solve cross-domain problem by setting up a local server to be a question of resources .
Solution:
To solve cross-domain problem by setting up a local server to be a problem of resources
- For example: node Open
- For example: phpStydy Open