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 6053985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:06:06+00:00 2026-05-23T08:06:06+00:00

How do I get a reference to the dom of a cross domain iframe/frame?

  • 0

How do I get a reference to the dom of a cross domain iframe/frame?

I want to do some stuff to disqus comments with an extension.

My manifest has the following:

"all_frames": true,
"matches": ["*://*.disqus.com/*","*://disqus.com/*", "http://somesite.com"]

I am not trying to communicate outside of the frame – that is the js will take care of the work without needing to ‘tell’ me anything.

all_frames should inject the listed js files into every frame, no?

When I do this:

if (window != window.top){
  alert('In an IFRAME: ' + window.location.href);
}

…I get the expected disqus URLs.

But when I do this:

var btnCommentBlock = document.getElementsByClassName('dsq-comment-buttons');
alert('btnCommentBlock length: ' + $(btnCommentBlock).length);

…I get 0 for length.

  • 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-05-23T08:06:06+00:00Added an answer on May 23, 2026 at 8:06 am

    Woohoo! I found the answer on github:

    https://gist.github.com/471999

    The working code is:

    $(document).ready(function() {
      window.disqus_no_style = true;
    
      $.getScript('http://sitename.disqus.com/embed.js', function() {
        var loader = setInterval(function() {
          if($('#disqus_thread').html().length) {
            clearInterval(loader);
            disqusReady();
          }
        }, 1000);
      });
    
      function disqusReady() {
        //whatever you can imagine
      }
    });
    

    I put this in the disqusReady() function:

    var aTestHere = document.getElementsByClassName('dsq-comment-body');
    alert(aTestHere[0].innerHTML);
    

    …and got back the innerHTML as expected.

    Mohamed, I’d really like to thank you for taking the time to interact with my question. If you hadn’t posted that link to github there’s no telling when if ever I’d have figured it out or found the other code.


    edit: After a few minutes of experimenting it looks like it is not necessary to call getScript so you should be able to comment that out.

    Also unnecessary is window.disqus_no_style so I commented that out too.

    I’ll experiment some more and update the answer later. One of those two things prevented me from being able to actually post a comment at the disqus site I use. //them out still allows access to the dom and the ability to post.

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

Sidebar

Related Questions

I want to get a reference to the Gmail Inbox button in Javascript? I
I want to pass a reference of the DOM object to a jQuery function.
I just appended some html to another JQuery object. I want to get a
I'm having some issues with a DOM element reference and I think I've tracked
When I get a reference to a System.Diagnostics.Process , how can I know if
How do I get the reference to a folder for storing per-user-per-application settings when
How would you get a reference to an executing class several stack frames above
How can I get a reference to the directory of the visual studio project
How can I get a reference to a module from within that module? Also,
How do I get Assembly reference for a .dll with no types in it?

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.