I'm developing my HTML5 game to match the device's screen, as a native mobile app would, I have a viewport meta that declared width to device-width and prevents zooming, as such:
<meta name = 'viewport' content = 'width = device-width, user-scalable = 0'/>
And a script that resizes the canvas to match the window:
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
The problem I encountered was that the graphics were noticeably blurry when I tested the game on my 1080p smartphone; and it turned out that my canvas' size (in portrait mode) was 424×829. I then removed device-width, and my webpage rendered 980×1915 in portrait, which is a bit off, and then 980×371 in landscape, which is only a tad better than device-width. How do I have it match the screen's pixel density? Thank you. Update: To be clear, I'm not having trouble fitting the canvas into the window, I'm having trouble having the window match the screen's resolution (e.g. be 1080 pixels wide on a 1080 pixel wide screen, rather than 980 or 424).