5

I'm trying to disable inspector on a simple A-Frame WebVR app with no success.

Tried to use and also disabling key press Ctrl + Alt + I using JavaScript. But, inspector is still loading.

Does anyone knows how to do that?

My scene is really simple:

<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>
H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
  • Possible duplicate of [Disable A-Frame inspector (for production)](https://stackoverflow.com/questions/52500453/disable-a-frame-inspector-for-production) – Diego Marcos Feb 13 '19 at 03:47

4 Answers4

3

You can add a disable-inspector component that calls the remove function of the inspector, and then use this component on the scene.

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

and in your html file:

<a-scene disable-inspector>
  ...
</a-scene>
goldor
  • 31
  • 2
  • 6
1

this should work for 0.5.0

var sceneEl = document.querySelector('a-scene');
sceneEl.components.inspector.remove();
Logic C
  • 11
  • 1
0

The inspector is not bundled with A-Frame but downloaded on demand when opened. Disabling won't make any difference in library size. I recommend keeping it to preserve the open spirit of the Web where we can learn from each other. Are you worried about the built-in browser dev tools inspecting your site? The inspector is the equivalent for A-Frame markup. if you still want to disable you can do:

<a-scene inspector="url: xxx">
Diego Marcos
  • 4,502
  • 3
  • 15
  • 20
  • Inspector still loads. – Rodrigo Brito Apr 27 '17 at 21:14
  • 1
    Here is the code: ` – Rodrigo Brito Apr 27 '17 at 21:20
  • @Marcos Are there any update on this? In my application I don't need inspector event in development mode. Could I just completely remove the dependency? – Fei Feb 13 '19 at 03:36
0

Updated: <a-scene inspector="url: blahblah">

ngokevin
  • 12,980
  • 2
  • 38
  • 84