Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Denied Error

Status
Not open for further replies.

damann

Technical User
Jul 19, 2000
114
US
Hello all,

Just wondering why I'm getting a JavaScript Access Denied error when I make the below calls. The error actually shows up on the second line below:

var objFrame = document.frames("iFramesID");
var objFrameElement = objFrame.frameElement; - Access Denied error happens here.

The reason I know the it happens here is because I put alerts before and after each line and my alerts before and after line one goes off, but the alert after line 2 doesnt. When I expected it to, I get the Access Denied error. Thanks a bunch for your help...


Thanks,
Damann

 
Another reason could be because the frame you calling has no document tree. to create a document tree for that frame give it a body ie(<body></body>).

someone advise me if im wrong cause im sure ive resolved a similar problem in such a way.

---------------------------
ServerOp: LogicSoft
 
Hey guys,

Thanks for your comments. I saw the document from MSDN with it erroring out because the page in the iFrame potentially being from another domain, but it actually isn't - the iframe is opening a page from the same domain from what I can tell. The thing that's hard to understand is that this code worked before, I recently upgraded from Windows2000 to Windows XP 2003 and I noticed the problem. Also, the page in the iframe loads and I can see there just that the JavaScript error pops up and the frame doesnt resize like I expect it to. If this is indeed erroring out because of the domain issue, is there a workaround for this? I only want to change the height of the iframe that's all...

Here is my code below:

function fnResizeFrame(){
var objFrame = document.frames("iFrameContent");
var objFrameElement = objFrame.frameElement; - Error happens here...
var blnResized = false;
if (objFrameElement.readyState == 4){ - Also, can't seem to get the readyState
document.all.imgProgress.style.display="none";
document.all.iFrameConent.style.height = objFrame.document.body.scrollHeight;
blnResized = true;
}
else
document.all.iFrameContent.style.height = '100%';
return blnResized;
}

Thanks,
Damann
 
Code:
function fnResizeFrame(){
  [red]  var objFrame = [blue]top.[/blue]document.frames("iFrameContent");[/red]
    var objFrameElement = objFrame.frameElement; - Error happens here...
    var blnResized = false;
    if (objFrameElement.readyState == 4){ - Also, can't seem to get the readyState
         document.all.imgProgress.style.display="none";
             document.all.iFrameConent.style.height = objFrame.document.body.scrollHeight;
           blnResized = true;
    }
    else
         document.all.iFrameContent.style.height = '100%';
        return blnResized;
            }

does that cause anything to work

---------------------------
WORD OR VOTE TO THE WISE IS ENUFF...;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top