By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,276 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,276 IT Pros & Developers. It's quick & easy.

Access Denied Error in Frames

P: 32
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
Share this Question
Share on Google+
6 Replies


P: 32
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+
P: 171
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

P: 32
Hello sir,
Can you ellaborate your idea briefly.
A.suresh
Feb 16 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Does this issue only occur in IE? See this KB article.
Feb 16 '07 #5

acoder
Expert Mod 15k+
P: 16,027
Merged threads.
Feb 16 '07 #6

P: 32
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.