473,508 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems resizing iframe

4 New Member
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 4468
PCgeek
4 New Member
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 New Member
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 New Member
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
1933
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
2372
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
1725
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
1764
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
10594
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
4377
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
2400
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
2675
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...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. 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.