Javascript implemented iFrame has extended bottom how do I hide it?


Popular question on positioning content exactly within iframe and I have only found one true solution however I can't perfect its use.

Code Below.

You should be able to quickly test it yourself and see that my example is a flash game which is boxed off nicely HOWEVER. If you put a div below the iframe it ends up about 500 pixels lower creating a large empty space. Its obvious what setting creates the exact height however when I change it from 794 to anything lower it effects the iframe content view. Counter balance has been impossible, maybe something I'm not getting!

Any help on would be great. I know iFrames are to be buried however I don't believe they should be and plan to use them a lot so help is great right now.
<style type="text/css">
				#innerIframe{ position:absolute;
				/* increase to nudge right, decrease to nudge left. Note negative number. */
				/* increase to nudge down, decrease to nudge up. Note negative number. */
				<div id='outerDiv'>
				<iframe id='innerIframe' scrolling=no  src=''>
				<script type='text/javascript'>
				_rect=new Array();
				_rect.push(-220);//site left
				_rect.push(-385);//moved site up
				_rect.push(130);//increase window size to right
				_rect.push(0);//extends or decreases bottom bottom
				_rect.push(622);//changed overall view width
				_rect.push(794);//Changed overall view height

Open in new window

Ryan BayneWordPress DeveloperAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

DubouxConnect With a Mentor Commented:
Okay, bad news...

JavaScript is restricted to act on pages outside the domain.

But I can´t seem to get a page inside an iframe to scroll anyway, whether it´s a local page in there or not.. Unless the javacommand to scroll (which is scrollBy(xvalue, yvalue), btw) is on the page inside the iframe itself..

So, what you can try to do, and this is a dirty trick, is to make a local php-page inside the frame, that fetches the source code from the page you want to show, and adds the correct javascript command to scroll on load.

Sorry for the bad news..
Okay, lol... first of all.. please tidy your script, as this is pain to look at ;P
Second.. Have you tested your script in other browsers than IE (or w/e u were using) ?

And I'm not sure what you are trying to do, other than just showing that game on your page, so here's how you show that game on your page, in all browsers, using clean, neat and tidy code ;)

<style type="text/css">
        width: 550px;
        height: 400px;
        border: 10px solid yellow;
<div id="outerDiv">
    <object id="FlashGame" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,29,0" width="550" height="400">
        <param name="movie" value="">
        <param name="quality" value="high">
        <embed src="" quality="high" pluginspage="" type="application/x-shockwave-flash" class="FlashGame" width="550" height="400">

Open in new window

Ryan BayneWordPress DeveloperAuthor Commented:
Its not actually my script and I normally get it working then tidy so sorry about that.

I need the iFrame working as it is to be used many times. That flash game was just a quick example.

You can see the problem if by testing that script and putting another div or paragraph under all of it. It ends up way down the page. Hope that makes sense.
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.


Okay, so you want an iframe that has a page inside, scrolled to the right position to show a specific area ?
Ryan BayneWordPress DeveloperAuthor Commented:
Yes, I used to do it easy a long time ago but the usual code did not work and I read its become a bit old with W3C so I figured the browser was not supporting it or something?!

Are you going to tell me I don't need this JS?
Well, while I'll look for your answer, your code in the first post doesn't work in other browsers than IE.
And most browsers exept IE only work according to the W3C rules and standards.
Ryan BayneWordPress DeveloperAuthor Commented:
Well that changes a lot of my plans for implementing a lot of iFrames in a lot of ways! I was going to display all of my clients websites on 1 page in my admin area for a quick status check on stats and other implementations for handyness.

I'll look into using those standard frames but I aint used them since before uni and I hate them! Thanks for doing that research and coming to a conclusion. Sometimes when I was reading about iFrames I couldnt figure out if people were saying they had a complete solution or PART of a solution or NONE at all!  lol

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.