473,394 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

changing Iframe's height from itself ..

Hi ,
I am using a cross domain iframe in my page..
If i want to change the iframe height a/c to its content height , its
giving Permission denied error as i am trying to access a function,
which changes an iframe's height, in the parent window ...
So Is there any way to change its height from the iframe
itself???????
Plz help me out in this case ..........
Thanx in advance..................

Nov 6 '06 #1
3 2608
Prasad wrote:
So Is there any way to change its height from the iframe
itself???????
As said (in de.comp.lang.javascript), for IE/Win you can use
window.resizeTo(someWidth, someHeight)
even on iframe window objects and it will resize the iframe. As for
getting the document height, look into the function you already have, it
is simply a question of accessing the right document properties e.g.
window.resizeTo(document.documentElement.offsetWid th,
document.documentElement.scrollHeight);
where the only problem is that depending on the IE version and the
rendering mode you need to access document.documentElement or document.body.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 6 '06 #2

Martin Honnen wrote:
Prasad wrote:
So Is there any way to change its height from the iframe
itself???????

As said (in de.comp.lang.javascript), for IE/Win you can use
window.resizeTo(someWidth, someHeight)
even on iframe window objects and it will resize the iframe. As for
getting the document height, look into the function you already have, it
is simply a question of accessing the right document properties e.g.
window.resizeTo(document.documentElement.offsetWid th,
document.documentElement.scrollHeight);
I am using a function ...........

function changeHeight()
{
//
window.resizeTodocument.documentElement.offsetWidt h,document.documentElement.scrollHeight);

// window.resizeTo(200,400);
window.resizeTo(document.documentElement.offsetWid th,document.body.scrollHeight);
setTimeout("changeHeight()",1000);
}
its first time called when iframe body is loaded ..
But its behaving very wierd .. the height of the iframe is increasing
and decreasing to some arbitrary value and after some time, an error
that "Access is denied " is being displayed ...

this iframe's domain is different from the parent's domain .....(but i
dont guess its a problem ..)

And i tested this function with a sample iframe in the same domain ..
its working fine... ( )
what could be the problem in the first case ??


where the only problem is that depending on the IE version and the
rendering mode you need to access document.documentElement or document.body.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 7 '06 #3
Hi!

In order to prevent cross-domain security problems, browsers enforce
the so-called "same origin policy" in the javascript object model,
making it impossible to access the iFrame and its properties whenever
it stems from another domain. So, as far as I know, what you want is
impossible. I'd certainly love to hear the opposite though!

Best regards,
- Alex.

On 6 Nov 2006 02:36:53 -0800, "Prasad" <pr*******@gmail.comwrote:
>Hi ,
I am using a cross domain iframe in my page..
If i want to change the iframe height a/c to its content height , its
giving Permission denied error as i am trying to access a function,
which changes an iframe's height, in the parent window ...
So Is there any way to change its height from the iframe
itself???????
Plz help me out in this case ..........
Thanx in advance..................
Nov 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Catherine Lynn Smith | last post by:
I want to know the recommended way to handle scripting of/with containers such as an iframe. I have a page with border-navigation bars on the top/bottom/left/right and I want to use an iframe to...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
1
by: Robert de Ridder | last post by:
I use an asp page to display pages, where the dynamic content is in an iframe. To calculate the height of the iframe I use the calcheight function. However when trying to do this with external...
1
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I...
3
by: bulldog8 | last post by:
I am having problems with changing a frames source file for Mozilla (1.5.0.4). The followig code works for IE: <script type="text/javascript"> var imgP = new Image(); function...
0
by: tequilamala | last post by:
I have an Iframe in one of the pages i am developing... the iframe is suppose to scroll up and down and the links target the iframe. the problem is that the iframe scrolls side to side on internet...
1
by: Z1P2 | last post by:
I would like to gradually resize an iframe in an onmouseover event. I can easily do it with an image, but when I try to do it with an iframe, it doesn't do anything. So first of all, is it possible...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...

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.