浏览器打开 three.js-r160/editor/index.html 后,为何显示白屏

从 百度网盘 请输入提取码 下载 three.js-r160.zip  解压到 D:\

请先看:Three.js 编辑器 editor 使用详解

浏览器打开 /three.js-r160/editor/index.html 时出现白屏可能是由于以下原因:

资源加载失败:页面依赖的 JavaScript 或 CSS 文件没有正确加载。

跨域问题:如果你是从本地文件系统打开这个页面,浏览器的安全策略可能会阻止加载某些资源。

JavaScript 错误:页面中的 JavaScript 代码可能存在错误,导致页面渲染失败。

浏览器兼容性:你使用的浏览器可能不支持所需的 HTML5 特性或者 WebGL 。

解决方法:

检查网络请求:检查浏览器的开发者工具中的网络(Network)面板,查看是否有资源加载失败。

本地服务器:使用本地服务器(如 Apache, Nginx, 或 HTTP 服务器)来托管页面,而不是直接从文件系统打开。

检查控制台:查看浏览器的开发者工具中的控制台(Console)面板,查找 JavaScript 错误或警告信息。

更新浏览器:确保你的浏览器是最新版本,或者至少支持 WebGL。

WebGL 检查:使用 WebGL 检测工具来检查系统的 WebGL 支持情况。

如果以上方法都不能解决问题,可能需要更详细的错误信息或者进一步的调试来确定问题所在。

参阅:http://www.webgl3d.cn/pages/aac9ab/

cd D:\three.js-r160 
python -m http.server

浏览器访问  http://localhost:8000/editor/
浏览器访问  http://localhost:8000/examples/ 


从 nginx: download  下载 nginx-1.26.1.zip  解压到D:\nginx-1.26.1

编辑 D:\nginx-1.26.1\conf\nginx.conf  第35行后:

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://127.0.0.1:8000;
            root   D:/three.js-r160;
            index  index.html index.htm;
        }
        # 
        location ~*  \.(css|js|txt|glb|mp4)$ {
            root  D:/three.js-r160;
            access_log off;
            expires 24h;
        }

先运行 nginx.exe -t
nginx: the configuration file D:\nginx-1.26.1/conf/nginx.conf syntax is ok
nginx: configuration file D:\nginx-1.26.1/conf/nginx.conf test is successful

cd D:\nginx-1.26.1
启动命令:  start nginx
修改 nginx.conf 后,重新启动: nginx -s reload

快速停止命令:nginx -s stop 
正常退出命令:nginx -s quit

copy D:\nginx-1.26.1\html\index.html  D:\three.js-r160\      
浏览器访问  http://localhost/editor/

参阅:Three.js editor 学习笔记(一) 也可以设置:中文 菜单

浏览器访问  http://localhost:8000/examples/ ,
如果配置了 nginx 代理,也可以访问 http://localhost/examples/

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值