Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Iframe won't scroll! It works fine in FireFox, Chrome, and IE

I wrote a simple holder to display websites writen for phones on larger screens. In it I simply have an Iframe. This works great for FireFox, Chrome, and IE (although IE does not work well with HTML5). However on Safari instead of scrolling the Iframe expands. Below is my holder page.


I've been testing with an IPad 3.


Thanks for any advice.


Joel


<html>

<head>

<title>Phone Internet</title>

<meta name="viewport" content="width=device-width, user-scalable=no">

<style type="text/css">

<!--

div.Title{font-family: Arial, Helvetica,sans-serif;font-size: 18px;}

div.Copy{font-family: Arial, Helvetica,sans-serif;font-size: 12px;}

#CellWindow{width: 320px;height: 480px;overflow:scroll}



-->

</style>

<script type="text/javascript">

<!--



if (navigator.userAgent.indexOf('MSIE') > -1){alert("This page is best viewed with Chrome, FireFox and Safari. Other browsers may not display

// -->

</script>

</head>

<body bgcolor="#808080">

<div align="center" class="Title">Mobile Phone HTML Examples</div>

<div align="center">

<iframe id="CellWindow" height="480" width="320" scrolling="yes" noresize="noresize" src=""></iframe>

</div>

<div align="center" class="Copy">&copy;Joel Moses 2012</div>

<script type="text/javascript">

<!--

document.getElementById("CellWindow").src = "http://www.zendisoft.com/mobile/index.htm";

document.getElementById("CellWindow").style.height="480px";

// -->

</script>

</body>

</html>


Thanks for the help.

iPad 2

Posted on May 3, 2012 8:55 PM

Reply
4 replies

Sep 26, 2012 10:21 PM in response to joelmoses454

User csdco (https://github.com/fancyapps/fancyBox/issues/2#issuecomment-5997068) has provided a simple answer that solved the issue for me.



-----------------------------------

It's much easier to control overflowed divs than it is iframes, and the scrolling + blank content issues are working all the way back to iOS 4, where previously I wasn't even able to get the 2 finger scrolling to work (in iframes).



It goes something like this:

<iframe id="stupid-iframe" width="600" height="200" src="a-file.html"></iframe>



a-file.html:

<html>

<body>

<div id="wrapper" style="width: 100%; height: 100%; overflow: auto; -webkit-overflow-scrolling: touch;">

...

</div>

</body>

</html>

Iframe won't scroll! It works fine in FireFox, Chrome, and IE

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.