I’m trying to load a 3D GLTF model from a python server I’m locally hosting, something like http://localhost:8000/navigate/to/GLTF.gltf. I’m using GLTFLoader with this code:
var loader = new THREE.GLTFLoader();
loader.load(
‘http://localhost:8000/TestObjects/scene.gltf’,
function (gltf){
scene.add(gltf.scene);
}
);
After running this it comes up with an error in a chrome browser opened with “start chrome --allow-file-access-from-files”:
“Access to XMLHttpRequest at ‘http://localhost:8000/navigate/to/GLTF.gltf’ from origin ‘file://’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”
This only doesn’t work with localhosting, it works when I simply call the loader from my files normally, but I need to be able to pull a model from a local host. any suggestions?
EDIT: Formatting