Cross-Frame Scripting, IFRAME and https (access denied)

  • Follow


I'm trying to dynamically set the height of my Iframe.  my https: main page
is calling another https in an Iframe.  But i get an access denied error
from my javascript trying to call the parent document.

Main https page
       <IFRAME  APPLICATION="yes"    style="width:100%;"  id="iframename"
frameborder="no" scrolling="no" SRC="https://www.otherdomain.com">



otherdomain.com html
------------------------------------------------
<script>
function bodyheight() {
    x = document.body.scrollHeight
    parent.document.all.iframename.style.height = x
}
</script>




0
Reply dangreece (2) 5/7/2004 5:49:28 PM

Cindy Lee wrote:
> I'm trying to dynamically set the height of my Iframe.  my https: main page
> is calling another https in an Iframe.  But i get an access denied error
> from my javascript trying to call the parent document.
> 
> Main https page
>        <IFRAME  APPLICATION="yes"    style="width:100%;"  id="iframename"
> frameborder="no" scrolling="no" SRC="https://www.otherdomain.com">

And there, in your SRC attribute, is the source of your problems. You 
are trying to script one domain from another and that is a *very* 
serious breach of security. It doesn't matter that they both belong to 
you, the browser doesn't care. They aren't the same domain.

 > otherdomain.com html
 > ------------------------------------------------
 > <script>
 > function bodyheight() {
 >     x = document.body.scrollHeight
 >     parent.document.all.iframename.style.height = x

Further, that line will only work in IE and a very small list of other 
browsers since its the only ones that support document.all

-- 
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
0
Reply Randy 5/7/2004 6:18:42 PM


1 Replies
856 Views

(page loaded in 0.336 seconds)

Similiar Articles:












7/23/2012 9:19:11 PM


Reply: