Skip to content

Commit

Permalink
add viewport meta for mobile
Browse files Browse the repository at this point in the history
based on unity's more recent minimal template; shared by mattia fortunati
  • Loading branch information
seleb committed Aug 9, 2022
1 parent 0557234 commit 6e6a0e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions WebGLTemplates/BetterMinimal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@
});
window.addEventListener('resize', onResize);
onResize();

if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
const meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
}
</script>
</div>
</body>
Expand Down

0 comments on commit 6e6a0e6

Please sign in to comment.