# Imitating Iframe or Finding Dynamic Height Iframe Solution



## Mn3MoN1C (Aug 31, 2005)

Hey guys, I'm working on a page on my website where I am trying to embed another website in it. I normally don't like using iframes as much but it seemed like the best possible solution.

Here is the link: Here

The problem is that the website I am embedding has different heights based on what you click. So I tried to implement(via jQuery and Javascript) a way to resize the iframe based on the the height of the inner frame. However, I kept receiving a permission denied error on calls to document.body. I did a little research and found that it's quite hard to do dynamic iframe height based with crossdomains. I found some fixes but they required that I have access to both pages to implement Javascript. Thing is that the website I am embedding is a website that I don't have access to so I can't put in the proposed Javascript fixes. My question is does anyone know of a way to fix this or of simply a way to mimic an iframe and embed another webpage into mine?

Any help would be very much appreciated.


----------



## rushlink (Apr 1, 2008)

I did have it working once. I just had javascript find the height of the window (and when the window was resized), and put the iframe height attribute as the height of the window (-some amount of px, because of title bar, etc...), and it worked well... Do you get it?


----------



## Mn3MoN1C (Aug 31, 2005)

The problem with that is that javascript will return a Permission Denied error in firefox because since they're not the same domain it's not supposed to be able to access that information. I'm not 100% sure but from what I read it's to prevent script injections.


----------



## Redcore (Aug 14, 2007)

rushlink said:


> I did have it working once. I just had javascript find the height of the window (and when the window was resized), and put the iframe height attribute as the height of the window (-some amount of px, because of title bar, etc...), and it worked well... Do you get it?


That's exactly what I was thinking would have to be done.

Unfortunately this kind of stuff is REALLY sticky to implement on popular web sites. There are so many browser configurations out there that something like this is bound to fail on quite a few people (*hopefully* it would fail gracefully). This is why I stopped using so much JS.


----------



## Mn3MoN1C (Aug 31, 2005)

Any thoughts on how to perhaps mimic an iframe using some other methods?


----------

