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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:04:31+00:00 2026-05-25T11:04:31+00:00

I have chromeless application with some privileged JavaScript code interacting with the system.Now I

  • 0

I have chromeless application with some privileged JavaScript code interacting with the system.Now I want to mash-up the privileged JavaScript (jsctypes) with an application hosted in the server. The remote application will be loaded in an Iframe and the interaction between the chromeless application and remote application happens through html5 postMessage.

The parent does post message to the contained Iframe and is successfully received by the Iframe with e.origin as “resource:\app”
whereas if I try to postMessage from Iframe to window.parent with domain as resource:\app the onmessage listener in the parent is not invoked

The layout,

On executing, >chromeless examples\testapp\index.html
A xul application is generated in the chromeless build folder and the following is shown.

+-----------------------------------Chromeless----+
|                                                 |
|   --- MessageToIframeButton                     |
|                                                 |
|  +--------------------------Iframe--+           |
|  |Msg Recvd from: resource://app    |           |
|  |(this is the message from parent) |           |
|  |                                  |           |
|  |   _TxtBox_sendMessage            |           |
|  |                                  |           |
|  |                                  |           |
|  |                                  |           |
|  +----------------------------------+           |
|  Msg Recvd:                                     |
|                                                 |
+-------------------------------------------------+

postMessage inside Iframe

  [Code]
 var sendMessage = function(){
      var iframe = window.parent;
      iframe.postMessage("test","resouce://app");  
   };

  [/Code]

onMessage of Parent ,

           var onmessage = function(e) {
               alert("message");
             }
           if(typeof window.addEventListener != 'undefined') {
               window.addEventListener('message', onmessage, false);
             }
          else if(typeof window.attachEvent != 'undefined') {
               window.attachEvent('onmessage', onmessage);
              } 

Any Help appreciated!

Palant,I tried to implement the cross domain communication using custom events but could not succeed,

In Priviliged index.html [Chromeless examples\testapp\index.html]:

     var myExtension = {
            myListener: function(evt) {
            alert("Received from web page: " +
            evt.target.getAttribute("attribute1"));
        }
        }
document.addEventListener("MyExtensionEvent", function(e) {myExtension.myListener(e); }, false, true); // The last value is a Mozilla-specific value to indicate untrusted content is allowed to trigger the event.
    //content.addEventListener("MyExtensionEvent", function(e) {myExtension.myListener(e); }, false, true); //Also tried with content.

In the remote app Iframe remote.html:
On click of a button,

    var element = document.createElement("MyExtensionDataElement");
element.setAttribute("attribute1", "foobar");
document.documentElement.appendChild(element);

var evt = document.createEvent("Events");
evt.initEvent("MyExtensionEvent", true, false);
element.dispatchEvent(evt);

The triggered event does not bubble to the privileged parent domain.If an eventListener is added to the Iframe itself the dispatched Event is received and similarly if the custom-event is generated in the privileged context(index.html) then the parent window does receive a notification but not across hierarchy. Am I missing something basic??

  • 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-25T11:04:32+00:00Added an answer on May 25, 2026 at 11:04 am

    Given that you link to Prevent target="_top" from taking over UI in Mozilla Chromeless I guess that the frame you loaded the remote application into is a content frame (which it definitely should be). This means that a security boundary is established between your privileged code and the content, and in particular for the frame it looks like it is on the top level – it cannot access the privileged document (easy to check, add alert(window == window.parent) to the frame code). All this makes sense security-wise but it also means that using postMessage() for communication will not be possible.

    There is a somewhat more awkward communication method described on https://developer.mozilla.org/en/Code_snippets/Interaction_between_privileged_and_non-privileged_pages. It has the advantage that it can securely cross the security boundary.

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

Sidebar

Related Questions

Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a LinqtoSql query that I now want to precompile. var unorderedc = from
Have some data in a sybase image type column that I want to use
In my button.xul file I have this: <script type=application/x-javascript src=chrome://mf_unblocker/content/button.js/> <toolbarbutton id=custom-button-1 label=Custom tooltiptext=MAFIAAFire:
I have a chromeless button in a WPF application that uses the XAML style
I'm trying to get the youtube as3 chromeless player to work. I have followed
A player: http://www.yvoschaap.com/videowall/ How can you customise the above Chromeless Youtube to have Play/Stop/Pause
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have a n-tire web application and search often times out after 30 secs. How

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.