How can I make my canvas area suitable for iphone browser?

I created a game using HTML5. canvas size 320x480. When the web page opens in the iphone browser, the canvas area will be placed in the upper left corner of the browser, and if I do not enlarge it, I will not be able to play the game. What can I do .. please help. Thank you

+5
source share
1 answer

You need to set the meta tag for the viewport to the iPhone screen size.

<meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0;"/>

This will allow you to correctly scale the page so that you do not need to automatically zoom in on the image, and this will prevent the user from scaling after opening the page.

+5

All Articles