I am trying to automatically resize the iframe to fit the content. Works great in chrome, firefox and opera.

Fails in Internet Explorer. Ideas?

<html xmlns="http://www.w3.org/1999/xhtml"><head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Leontinas</title>
        <script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript">
              var framefenster = document.getElementsByTagName("iFrame");
              var auto_resize_timer = window.setInterval("autoresize_frames()", 20);
              function autoresize_frames() {
                for (var i = 0; i < framefenster.length; ++i) {
                    if(framefenster[i].contentWindow.document.body){
                      var framefenster_size = framefenster[i].contentWindow.document.body.offsetHeight;
                      if(document.all && !window.opera) {
                        framefenster_size = framefenster[i].contentWindow.document.body.scrollHeight;
                      }
                      framefenster[i].style.height = framefenster_size + 'px';
                    }
                }
              }
          </script>

<link href="cygnacss.css" type="text/css" rel="stylesheet">
</head>


<body style="overflow:scroll">

<iframe allowtransparency="true" frameborder="0" height="0" id="iFrame" name="iFrame" scrolling="no" width="208" src="login.php"></iframe>

</body>
</html>

**
Works great in:
FF, Chrome and Opera - But it doesn't seem to be working in IE 9+.

How can I try and get this fixed and what is causing the problem?**

Recommended Answers

All 5 Replies

Post in the correct forum?

This is PHP

Member Avatar for LastMitch

I am trying to automatically resize the iframe to fit the content. Works great in chrome, firefox and opera.

Like what Squidge mention you post this in the wrong section. It should be in the Javscript section.

What are you trying to do with the code another words what goes in the iFrame?

Did you write this code because there should be more than what you posted.

Where is the actual jQuery code? So this is only this file that runs this code:

<script type="text/javascript" src="js/jquery.js"></script>

Is a plugin that goes with a website platform like Joomla or Wordpress?

I gotta be the dumbest poster on this site... wrong title + wrong forum.

Sorry guys.

lol... too funny.

I gotta be the dumbest poster on this site... wrong title + wrong forum.

Please mark this solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.