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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:24:42+00:00 2026-05-23T21:24:42+00:00

I want to bubble some information from a frame to its parent object (information

  • 0

I want to bubble some information from a frame to its parent object (information that isn’t accessible due to XSS).

Can I compare the source window sent via postMessage to the values of window.frames?

MDN (in the link above) says that the message can be used to postMessage back but doesn’t refer to testing for equality.

This works correctly on IE9 FF5 and Chrome12 but I want to know if this is dependable (i.e. is it in the standard).

Test code:

postMessageOuter.html

<!DOCTYPE html>
<html>
<head>
    <title>Outer Page</title>
    <script type="text/javascript">
        window.addEventListener("message", function (event) {
            for (var i = 0; i < frames.length; ++i)
                if (event.source == frames[i])
                    alert(i);
        }, false);
    </script>
</head>
<body>
<iframe src="postMessageInner.html"></iframe>
<iframe src="postMessageInner.html"></iframe>
<iframe src="postMessageInner.html"></iframe>
</body>
</html>

postMessageInner.html

<!DOCTYPE html>
<html>
<head>
    <title>Inner Page</title>
    <script type="text/javascript">
        function foo() {
            window.parent.postMessage("Hello", "*");
        }
    </script>
</head>
<body>
<input type="button" value="X" onclick="foo()" />    
</body>
</html>
  • 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-23T21:24:43+00:00Added an answer on May 23, 2026 at 9:24 pm

    postMessage is part of the HTML5 draft and thus supported in the newest browsers.

    The spec says

    the source attribute must be set to the script’s global object’s WindowProxy object

    this WindowProxy is the value of the window.frame enumeration, too.

    http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages

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

Sidebar

Related Questions

I have some thumbnails with gps info that I want to pass to a
I want to design some speech bubble like comment box in HTML with CSS.
Do you know some resource (url, pdf, etc.) that can help me to do
I'm working on an object that at some point instantiates another object. That inner
I want to implement an effect that, showing a picture on a bubble surface
I want to do so the size of the bubble, is auto-adjusting after the
want to have a Hyperlink-Button in a gridView in which I can display a
Is there some method to issue a screen capture(browser window content only) from the
I have a WPF UserControl representing a Person with many fields. Some Persons can
I want to make bubble of text appear when the mouse is over a

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.