WebGL 无缘无故停止在本地工作
我正在研究一些 WebGL 教程,但无缘无故,WebGL 停止工作了。我什至加载了一个未修改的 WebGL HTML 页面,该页面是我从网上下载的,之前运行良好。当我将相同的代码通过 FTP 传输到我的网络服务器并加载它时,它工作得很好。有两个问题......
- 为什么 WebGL 会突然停止在所有浏览器上本地工作?
- 为什么 WebGL HTML 代码在线运行良好,但在本地运行不佳?
我还应该提到我重新启动了计算机,卸载/重新安装了 Chrome 和 Firefox,并清除了所有互联网缓存。
非常感谢您的智慧!
I was playing with some WebGL tutorials and, for no reason, WebGL just stopped working. I even loaded an untouched WebGL HTML page that I downloaded from the web that worked fine before. When I FTP that same exact code to my web server and load it, it works fine. Two questions...
- Why would WebGL all of a sudden just stop working locally across ALL browsers?
- Why would WebGL HTML code run fine online, but not locally?
I should also mention I restarted my computer, uninstalled/reinstalled Chrome and Firefox, and cleared all my internet cache.
Thanks so much for all your wisdom!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发现问题了。防止本地页面访问您的整个硬盘
磁盘驱动器,每个本地 file:// URI 都是它自己的域,这意味着
局部纹理始终被视为跨域。在 Firefox 中,我可以通过修改 about:config 并将 security.fileuri.strict_origin_policy 设置为 false 来解决这个问题
Found the problem. To prevent a local page from accessing your whole hard
disk drive, each local file:// URI is its own domain, which means that
local textures are always treated as cross-domain. In Firefox, I was able to get around this by modifying the about:config and setting security.fileuri.strict_origin_policy to false
解决此问题的最简单方法是:
使用 Netbeans 或 Visual Studio 等 IDE 来运行应用程序。它们自动使用本地服务器,因此您不必在自己的服务器上运行它或弄乱您的浏览器。让浏览器访问本地数据或多或少是一个安全问题。
Easiest way to work around this problem:
Use some IDE like Netbeans or Visual Studio to run your application. They use a local server automatically, so you don't have to run it on your own server or mess around with your browsers. Letting browsers access local data is more or less a security issue.