Jump to content

JavaScript to resize iframed game not working on iPhone


plicatibu
 Share

Recommended Posts

Hi.

 

I am using the following code in order to show iframed games and it's working fine on Android (Opera, Firefox, Chrome and stock browser), but on iPhone the games are not showing anymore. Sometimes it even closes the Safari.

 

Could someone tell me what is wrong? I'm pretty sure it is something with my JavaScript code but I can figure out what is.

<html><head><meta charset="utf-8"><title>game name</title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta http-equiv="Content-Language" content="en"/><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><meta name="HandheldFriendly" content="true" /><meta name="mobile-web-app-capable" content="yes" /><style>html, body {    margin: 0;    weight:100%;    height:100%;}#ifr {    height: 100%;    width: 100%;    marginheight: 0;    marginwidth: 0;    frameBorder: 0;}</style><script><!--function autoResize() {        var iframe = document.getElementsByTagName( 'iframe' )[0];    iframe.width = window.innerWidth;    iframe.height = window.innerHeight    }//--></script></head><body onresize="autoResize();"><iframe id="ifr" src="games/mygame/index.html" onload="autoResize();" seamless></iframe></body></html>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...