diff --git a/templates/html5/output.js b/templates/html5/output.js
index e04a257441..21ba89df30 100644
--- a/templates/html5/output.js
+++ b/templates/html5/output.js
@@ -48,3 +48,18 @@ if (typeof define === "function" && define.__amd) {
define.amd = define.__amd;
delete define.__amd;
}
+
+if (typeof self !== "undefined" && !self.constructor.name.includes("Worker")) {
+ window.addEventListener ("touchmove", function (event) { event.preventDefault (); }, { capture: false, passive: false });
+ if (typeof window.devicePixelRatio != 'undefined' && window.devicePixelRatio > 2) {
+ var meta = document.getElementById ("viewport");
+ meta.setAttribute ('content', 'width=device-width, initial-scale=' + (2 / window.devicePixelRatio) + ', user-scalable=no');
+ }
+
+ window.addEventListener ("load", function () {
+ const content = document.getElementById(::if LIB_OPENFL::"openfl-content"::else::"content"::end::);
+ if (content && content.childElementCount === 0) {
+ lime.embed ("::APP_FILE::", content, ::WIN_WIDTH::, ::WIN_HEIGHT::);
+ }
+ });
+}
diff --git a/templates/html5/template/index.html b/templates/html5/template/index.html
index daac92480a..3719de96f3 100755
--- a/templates/html5/template/index.html
+++ b/templates/html5/template/index.html
@@ -16,14 +16,6 @@
::end::::end::
-
-