access denied error in iframe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • benoypaul
    New Member
    • May 2007
    • 28

    access denied error in iframe

    I have created iframe with following code
    Code:
    <iframe src="http://astore.amazon.com/" width="100%"  frameborder="0" name="amframe" id="amframe" height="1" scrolling="no" onLoad="resizeFrame1();" ></iframe>
    I have used following javascript code to access scrolheight of iframe , in order to remove scroll bar based on the height
    Code:
    var h= document.getElementById("amframe").contentWindow.document.body.scrollHeight
    I got "access denied" javascript error at the time of execution . I wish to know how to correct this error

    Thanks in advance
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    in case (and in your case it is) the loaded page in the frame is from another domain you cannot access it with javascript due to security issues ... because in case you could ... then you could 'Cross-Site-Script' and that would be a security hole ... you may have a look here

    kind regards

    Comment

    Working...