Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i make my canvas area fit to the iphone browser?

I ve created a game using HTML5. the canvas size is 320x480. When the webpage opens in the browser of an iphone the canvas area will be placed in the left top corner of the browser and unless i zoom it i cannot play the game. What is that i can do .. please help. Thanks.

like image 594
Sri Avatar asked Aug 11 '11 10:08

Sri


1 Answers

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

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

This will scale the page correctly so that you do not have to zoom in at first, and will prevent the user from scaling after the page has opened.

like image 120
Glenn Davidson Avatar answered Sep 22 '22 17:09

Glenn Davidson