467,081 Members | 1,060 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,081 developers. It's quick & easy.

Access Denied Error in Frames

Hi,
This is my first message to this forum.I am facing one problem in frames.when i am trying to access child frame from parent frame i am getting "Access Denied Error".i know the reason bcz i am trying to access the frame in different domain.is there any way to tackle this problem

my code:

parent frame:
<html>
<script>
function displayURL(){
alert("child frame URL="+self.childframe1.location.href);
// above line i am getting the 'Access Denied Error'
}
</script>
<frameset id="mainframe" rows="100%,*" border="0">
<frame id="childframe1" name="childframe1" src="child1.php" onload="displayURL()">
</html>

child frame: child1.php:
<html>
<script type="text/javascript">
function displaygoogle(){
parent.childframe1.location.href="http://www.google.com";
}
</script>
<body>
<a href="javascript:displaygoogle();">Display Google</a>
</body>
</html>

When the page is getting loaded for first time.the alert box is displaying as "child frame URL=http://www.ABC.com/child1.php". suppose when i click the 'Display google' link in child frame,the google web site is displaying in my child frame but the alert box is not displaying "it's telling Access Denied Error".

A.suresh
Feb 15 '07 #1
  • viewed: 3143
Share:
6 Replies
Hi,
This is my first message to this forum.I am facing one problem in frames.when i am trying to access child frame from parent frame i am getting "Access Denied Error".i know the reason bcz i am trying to access the frame in different domain.is there any way to tackle this problem

my code:

parent frame:

<html>
<script>
function displayURL(){
self.childframe1.location.href="http://www.google.com";
alert("child frame URL="+self.childframe1.location.href);
// this line i am getting the 'Access Denied Error'
}
</script>
<frameset id="mainframe" rows="100%,*" border="0">
<frame id="childframe1" name="childframe1" src="child1.php">
</html>

child frame:(child1.php):

<html>
<body>
<a href="javascript:parent.displayURL();">Display Google</a>
</body>
</html>

When the page is getting loaded for first time.the alert box is displaying with "http://www.ABC.com/child1.php". suppose when i click the 'Display google ' link in child frame,the google web site is displaying in my child frame but the alert box is not displaying "it's telling Access Denied Error".
Feb 15 '07 #2
b1randon
Expert 100+
Hi,
This is my first message to this forum.I am facing one problem in frames.when i am trying to access child frame from parent frame i am getting "Access Denied Error".i know the reason bcz i am trying to access the frame in different domain.is there any way to tackle this problem

my code:

parent frame:

<html>
<script>
function displayURL(){
self.childframe1.location.href="http://www.google.com";
alert("child frame URL="+self.childframe1.location.href);
// this line i am getting the 'Access Denied Error'
}
</script>
<frameset id="mainframe" rows="100%,*" border="0">
<frame id="childframe1" name="childframe1" src="child1.php">
</html>

child frame:(child1.php):

<html>
<body>
<a href="javascript:parent.displayURL();">Display Google</a>
</body>
</html>

When the page is getting loaded for first time.the alert box is displaying with "http://www.ABC.com/child1.php". suppose when i click the 'Display google ' link in child frame,the google web site is displaying in my child frame but the alert box is not displaying "it's telling Access Denied Error".
If you want to cross domains you will have to do it from your server as nearly every browser will not allow this because it is such a security risk.
Feb 15 '07 #3
Hello sir,
Can you ellaborate your idea briefly.
A.suresh
Feb 16 '07 #4
acoder
Expert Mod 8TB
Does this issue only occur in IE? See this KB article.
Feb 16 '07 #5
acoder
Expert Mod 8TB
Merged threads.
Feb 16 '07 #6
Can any help me this isue.

i am setting self.childframe1.location.href="http://www.google.com";

from parent frame.whether the above fn will replace the child frame src value to 'google.com' .
bcz After displaying the google.com website in my child frame.i checked this option alert("frame HTML="+document.getElementsByTagName('frameset')[0].innerHTML);

Its displaying the original frame src that is "frame HTML=<frame id='childframe1' src='child.php'></frameset>".
Feb 17 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Sergio del Amo | last post: by
reply views Thread by ASP.Confused | last post: by
6 posts views Thread by Angel | last post: by
4 posts views Thread by Chico Che | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.