472,363 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

Problems resizing iframe

4
sorry moved this over to javascript forum, didn't mean to post 2x!

Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page includes background music with a javascript music player on the main page below an iframe that is used for all content and navigation of the site and so that the music doesn't reload each time a page is switched. There is another javascript to resize the iframe to fit the content, so that it will adjust to the various page heights. The problem I'm having now is that it won't resize until it loads all the content (which includes some sizeable flash etc) and it is freezing during the resize process. It does however begin playing the music before resizing the iframe, and generally locks up saying it is still loading the indexforinline.htm, though it never actually completes and resizes (although I can hear my flash content loading working correctly -- the iframe is just not resized). Then I simply have to reload the iframe by clicking refresh, and it will appear correctly (now that the content is loaded) I'm thinking that it is loading the content ( i can hear it) , but not resizing the iframe in time to display it. One thing I would like to do is not load the music player until the iframe is loaded and resized, but this will only solve the resize problems on the homepage (or so I assume, because I have the same resize problems when navigating to other pages, and have to refresh them as well to get them to resize the iframe and display correctly)

Here is the code involved with the index.htm:

//script to resize iframe to correct height depending on content

<script language="JavaScript">
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindo w.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
//-->
</script>

</head>


<body bgcolor="#000000">

// Iframe loaded with indexforinline.htm containing all content and navigation
<p align="center">
<iframe width="1000" id="the_iframe"
onLoad="calcHeight();"
src="indexforinlinetest.htm"
scrolling="NO"
frameborder="0"
height="1">An iframe capable browser is
required to view the website.</iframe>

//background music player loaded to index.htm

<table align="right" border="0" cellspacing="0"cellpadding="0"><tbody><tr><td>
<div align="right">
<script language='JavaScript' src='musicplayer.js' type='text/javascript'></script></div>
<tr><td>
<p align="right">&nbsp;</td></tr></tbody></table>

<script language="JScript" type="text/jscript" src="../NoIEActivate.js"></script>

</body>



Anything you guys can suggest to ensure that the iframe resizes and displays correctly without refreshing the iframe would be greatly appreciated!! Thanks!!
Oct 13 '06 #1
3 4319
PCgeek
4
Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page includes background music with a javascript music player on the main page below an iframe that is used for all content and navigation of the site and so that the music doesn't reload each time a page is switched. There is another javascript to resize the iframe to fit the content, so that it will adjust to the various page heights. The problem I'm having now is that it won't resize until it loads all the content (which includes some sizeable flash etc) and it is freezing during the resize process. It does however begin playing the music before resizing the iframe, and generally locks up saying it is still loading the indexforinline.htm, though it never actually completes and resizes (although I can hear my flash content loading working correctly -- the iframe is just not resized). Then I simply have to reload the iframe by clicking refresh, and it will appear correctly (now that the content is loaded) I'm thinking that it is loading the content ( i can hear it) , but not resizing the iframe in time to display it. One thing I would like to do is not load the music player until the iframe is loaded and resized, but this will only solve the resize problems on the homepage (or so I assume, because I have the same resize problems when navigating to other pages, and have to refresh them as well to get them to resize the iframe and display correctly)

Here is the code involved with the index.htm:

//script to resize iframe to correct height depending on content

<script language="JavaScript">
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindo w.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
//-->
</script>

</head>


<body bgcolor="#000000">

// Iframe loaded with indexforinline.htm containing all content and navigation
<p align="center">
<iframe width="1000" id="the_iframe"
onLoad="calcHeight();"
src="indexforinlinetest.htm"
scrolling="NO"
frameborder="0"
height="1">An iframe capable browser is
required to view the website.</iframe>

//background music player loaded to index.htm

<table align="right" border="0" cellspacing="0"cellpadding="0"><tbody><tr><td>
<div align="right">
<script language='JavaScript' src='musicplayer.js' type='text/javascript'></script></div>
<tr><td>
<p align="right">&nbsp;</td></tr></tbody></table>

<script language="JScript" type="text/jscript" src="../NoIEActivate.js"></script>

</body>



Anything you guys can suggest to ensure that the iframe resizes and displays correctly without refreshing the iframe would be greatly appreciated!! Thanks!!
Oct 13 '06 #2
PCgeek
4
hmm the resize seems to be working in firefox, although it still loads and plays the flash objects in indexforinline.htm before the iframe is resized (don't get to see flash -- can hear it though), so this is something I would like to fix, to make sure the user sees the flash animations. (make the ifreame resize before the contents of indexforinline.htm is displayed) Internet explorer just hangs saying it is waiting on one item to finish loading from indexforinline.htm and the only way it will resize is by refreshing the iframe. any help or suggestions would be great. the main goal here is to have the music playing in the background without restarting when navigating to another page so maybe there is an easier way to do this? Thanks!!
Oct 14 '06 #3
PCgeek
4
someone recommended calling the resize from within the indexforinline.htm (content displayed in iframe) using document.parentSomethingOfOther.size = blah but not sure exactly how to go about doing this any suggestions would be appreciated
Oct 14 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: khothikhe | last post by:
can some one help me here coz this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari : ...
1
by: khothikhe | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari...
5
by: Paul Fi | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari...
1
by: Paul Fi | last post by:
I have this problem with iframes: i want to resize iframe's height when the window inside the frame is resized or when the src attribute of iframe changes so make the height of iframe equal to...
1
by: sam | last post by:
Hi all, Hope some expert can help me resolve this. I am using the following code to resize an iframe according to the content in it so that the iframe does not use its scroll bar and uses the...
13
by: bgraphics2031 | last post by:
I'm trying to get this iframe to dynamically resize by dragging a vertical bar, but it's not working in Mozilla (It originally worked in IE but I've been trying to port it over). Any help will be...
1
by: marco.dini | last post by:
Hello, this is my first time in this forum. We are redesigning our company's corporate site and since we need to add some content from an external application to the homepage, we are considering...
1
helpmepls
by: helpmepls | last post by:
i have a site where I have an iframe mainFrame which loads page content from the main menu (top horizontal menu). within this mainFrame is a second menu to left specific to the loaded page, and...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.