From 4b5a1775413aa8c7901a0e462d0aa61da91fb133 Mon Sep 17 00:00:00 2001 From: eska Date: Tue, 7 Mar 2017 01:46:06 +0100 Subject: [PATCH] Add to web docs - Document security restrictions - Document locale lookup - Various hints and fixes (cherry picked from commit 5e3d5ff14a46a0a94c5268b39adf204daca6b535) --- .../asset_pipeline/exporting_for_web.rst | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tutorials/asset_pipeline/exporting_for_web.rst b/tutorials/asset_pipeline/exporting_for_web.rst index 96056e73b..7c4b04ab7 100644 --- a/tutorials/asset_pipeline/exporting_for_web.rst +++ b/tutorials/asset_pipeline/exporting_for_web.rst @@ -30,9 +30,12 @@ Delivering the files with gzip compression is recommended especially for the Export options -------------- -Turning on **Debugging Enabled** when exporting will display a debug output -below the canvas, displaying JavaScript and engine errors. If controls are +Turning on **Debugging Enabled** when exporting will, in addition to enabling +various debug features of the engine, display a debug output below the canvas, +displaying JavaScript and engine errors. If controls are enabled as well, display of this output can be toggled. +You can also use the browser-integrated developer console, usually opened with +the F12 key, which often shows more information, including WebGL errors. **Memory Size** is fixed and must thus be set during export. Try using no more than necessary to strain users' browsers as little as possible. @@ -59,3 +62,29 @@ semicolon. output display in debug mode and a fullscreen button. In the default page, the controls are displayed in the top-right corner on top of the canvas, which can get in the way in games that use the cursor. + +Security restrictions +--------------------- + +Browsers do not allow arbitrarily **entering full screen** at any time. +Instead, these actions have to occur as a response to a JavaScript input event. +In Godot, this is most easily done by entering full screen from within an +``_input()`` callback. + +Chromium-derived browsers will not load exported projects when +**opened locally** per ``file://`` protocol. To get around this, you can start +the browser with the ``--allow-file-access-from-files`` flag, or use a local +server. Python offers an easy way for this, using ``python -m SimpleHTTPServer`` +with Python 2 or ``python -m http.server`` with Python 3 will serve the +current working directory on ``http://localhost:8000``. + +Locale +------ + +Godot tries to detect the user's locale using information provided by the +browser, but this is rather unreliable. A better way is to use CGI to read the +HTTP ``Accept-Language`` header. If you assign its value to the JavaScript +property ``Module.locale`` after the ``Module`` objects is created, but before +the engine starts, Godot will use that value to initialize the locale. +In any case, users should always be offered the option to configure the locale +manually.