这是一个简单的网页,以 .glb 格式显示 blender 文件
`<!DOCTYPE html>
<html>
<head>
<title>Render myfile.glb in HTML</title>
<meta http-equiv="Content-Security-Policy" content="default-src https://ajax.googleapis.com/ajax/libs/model-viewer/3.0.0/ filesystem 'self' ">
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.0.0/model-viewer.min.js"></script>
</head>
<body>
<model-viewer src="myfile.glb"></model-viewer>
</body>
</html>
`
html 文件和文件 myfile.glb 位于服务器上的同一目录中。浏览器不显示该文件。
firefox 的调试器状态:
内容安全策略:该页面的设置阻止了资源加载 https://ajax.googleapis.com/ajax/libs/model-viewer/3.0.0/model-viewer.min.js(“默认-源”)。
我该怎么做才能显示这个文件?这一定是一个愚蠢的错误,但也许其他人也有同样的问题......提前谢谢你。
我尝试了多种内容安全设置。 我在我的 PC 中尝试了一个本地文件(由于其他内容安全原因不起作用)。
我尝试了这里所说的一切:
没有成功——在 Firefox、Chrome 或 Opera 上都没有。