Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:12:13+00:00 2026-06-11T01:12:13+00:00

AFAIK we cannot access the DOM content of iframe which has been loaded from

  • 0

AFAIK we cannot access the DOM content of iframe which has been loaded from different domain. But in my case I have a website with below name

 http://dom1.myMainDomain.com/******  

In that page I am loading one HTML file from sub-domain into an Iframe in above website which is sub-domain of as above. i.e

 http://dom2.myMainDomain.com/******/1.html

I have tried below code but it is not working

 $(document).ready(function () {
    var str = "http://dom1.myMainDomain.com/*****Images/";
    $('body').append('<iframe id="ifr" style="position:absolute;top:0px;left:0px;width:100%;height:100%" src="' + str + $('#htmNum').val() + '.html"></iframe>');
    document.domain = "myMainDomain.com";
    $('#ifr').load(function () {
        $('#ifr').contents().find('body').html('Hey, i`ve changed content of <body>! Yay!!!');
    });
});

But it did not work for me.. and The web site where I am embedding the above code is

http://dom2.myMainDomain.com/*****.aspx    

Please help me on this. As per the answer I have tried and it was working in IE7./ But in Chrome I can see permission denied message

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:12:15+00:00Added an answer on June 11, 2026 at 1:12 am

    You must do document.domain = "myMainDomain.com"; in both paretnt page and here http://dom1.myMainDomain.com/*****Images/. Your document ready function is Ok, but you also should have similar piece of code in here http://dom1.myMainDomain.com/*****Images/. I would place it in head section like

    <head>
    <script type="text/javscript">
       document.domain = "myMainDomain.com";
    </script>
    </head>
    

    And suppose it would be better to move put the same code in head of parent document. Just to be sure that everything is set correctly in when you access an iframe

    Yeah. Just double checked it. I can access an iframe content with code like this:

    $("iframe").contents().find("body")
    

    if in both parent window and iframe there is document.domain = "com.local"; in javascript

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

AFAIK, a thread can not access UI components. But I want to preload images
This question is about the public key that every .NET assembly has AFAIK (looking
AFAIK we cannot assign directly values to record members if the said record is
My model has a method that will update several attributes in a model from
I have ControlA which accepts an IInterfaceB which has a property of type List<unknownType>
AFAIK, extern keyword should be used for declaration and no value can be associated
AFAIK, for pointers/references static_cast, if a class definition is not visible to compiler at
Afaik, you can change/manipulate browser settings in Mozilla/Netscape browsers. For Instance netscape.security.PrivilegeManager.enablePrivilege('someprivilege'); Of course
AFAIK when reducing an array we can only output once variable at the end
Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} AFAIK, there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.