【发布时间】:2022-12-19 00:27:57
【问题描述】:
I'm trying to load a 3D model, stored locally on my computer, into Three.js with JSONLoader, and that 3D model is in the same directory as the entire website.
I'm getting the "Cross origin requests are only supported for HTTP." error, but I don't know what's causing it nor how to fix it.
【问题讨论】:
-
Are you trying to do this locally?
-
You need to use localhost, even if its local file
-
But it sin't cross domain!
-
If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
-
Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
标签: javascript file http cross-domain cross-origin-resource-policy