CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012
    Posts
    11

    Help me ....JavaScript is annoying me

    Access Denied error in frames:

    When I try to access a child frame from parent frame I get "Access Denied Error". I know the reason is because I am trying to access the frame in a different domain. Is there any way to tackle this problem? my code: parent frame:

    Code:
    <html>
    <script>
    function displayURL()
    {
    self.childframe1.location.href="http://www.google.com";
    alert("child frame URL="+self.childframe1.location.href);
    // above line i am getting the 'Access Denied Error' 
    }
    </script>
    <frameset id="mainframe" rows="100&#37;,*" border="0">
    <frame id="childframe1" name="childframe1" src="child1.php">
    </html>
    
    child frame:(child1.php):
    <html>
    <body>
    Display Google
    </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".


    Can some one solve my query.....
    Any sort of help will be highly appreciated...
    Last edited by PeejAvery; January 27th, 2012 at 10:11 AM. Reason: Added code tags

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Help me ....JavaScript is annoying me

    You simply cannot use JavaScript to access properties from other domains. This would be a major security concern.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jan 2012
    Posts
    11

    Smile Re: Help me ....JavaScript is annoying me

    Quote Originally Posted by PeejAvery View Post
    You simply cannot use JavaScript to access properties from other domains. This would be a major security concern.
    Thanks for your valuable concern. It will improve ability of coding.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured