When I open the html file directly on my computer, an error message appears:
Access to fetch at ‘file:///C:/D*.glb’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.
my code:
const loader = new GLTFLoader();
let [gltf ] = await Promise.all([
loader.loadAsync('models/' + model_path + '.glb')
]);
If the code is accessed in http://localhost
, there is no problem.
but Now i need to access it under “file://” to realize the local(Android system) preview function.
How to solve this problem?
thanks!