create3000 / x_ite

X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.
https://create3000.github.io/x_ite/
Other
67 stars 15 forks source link

How to start X_ITE in a browser window in fullscreen mode #167

Closed olafgithub closed 5 months ago

olafgithub commented 5 months ago

I embedded X_ITE on an HTML page and like the page to start with the X_ITE window in fullscreen mode. Just like when selecting fullscreen from the right-click context menu.

Is there an attribute for the x3d-canvas element to do this? Or do you do this in the CSS style? Or can I do it using the browser in JavaScript code? Like after browser = X3D.getBrowser ( ... ); browser.fullscreen = "true"?

I searched for quite a long while in the documentation, but could not find anything,

Thanks,

Olaf

create3000 commented 5 months ago

X_ITE used the jquery-fullscreen-plugin and according to its documentation:

This only works when the code was triggered by a user interaction (For example a onclick event on a button). Browsers don't allow entering fullscreen mode without user interaction.

Nevertheless you could trigger a fullscreen (by a user interaction) if you do:

<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-fullscreen-plugin/jquery.fullscreen.min.js"></script>
<x3d-canvas src="some/world.x3d"></x3d-canvas>
<script>
$("x3d-canvas") .fullScreen (true);
</script>

See: https://github.com/code-lts/jquery-fullscreen-plugin

Nevertheless it is always possible to trigger fullscreen (by a user interaction) with pure JavaScript.

olafgithub commented 5 months ago

Thanks!

I can see the problem. (On the console) When I have time I will find a workaround.

Olaf

create3000 commented 5 months ago

I will close this issue now, but feel free to reopen again, or a new issue.