禁用检查员

问题描述 投票:3回答:4

我试图在一个简单的A-Frame WebVR应用程序上禁用检查器但没有成功。

尝试使用并禁用按键Ctrl + Alt + I使用JavaScript。但是,检查员仍在装载。

有谁知道怎么做?

我的场景非常简单:

<html>

<head>
  <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
</head>

<body>
  <a-scene>
    <a-assets><img id="render" src="back.png"></a-assets>
    <a-sky src="#render"></a-sky>
  </a-scene>
</body>

</html>
mozilla aframe webvr
4个回答
1
投票

这应该适用于0.5.0

var sceneEl = document.querySelector('a-scene');
sceneEl.components.inspector.remove();

1
投票

您可以添加一个禁用检查器组件来调用检查器的remove函数,然后在场景中使用此组件。

AFRAME.registerComponent('disable-inspector', {
  dependencies: ['inspector'],
  init: function () {
    this.el.components.inspector.remove();
  }
});

并在您的HTML文件中:

<a-scene disable-inspector>
  ...
</a-scene>

0
投票

更新:<a-scene inspector="url: blahblah">


0
投票

检查员未与A-Frame捆绑在一起,但在打开时按需下载。禁用不会对库大小产生任何影响。我建议保持它以保持网络的开放精神,我们可以相互学习。您是否担心内置的浏览器开发工具会检查您的网站?检查员相当于A-Frame标记。如果您仍想禁用,您可以执行以下操作:

<a-scene inspector="url: xxx">
© www.soinside.com 2019 - 2024. All rights reserved.