Hello all,

Hoping someone can help me with a little problem...

I am building an XUL app composed of a chrome window with an iframe.
When I first open run the app an html document is loaded from a URL into the iframe. In this html document I have a button as follows:


<input type="button" onclick="window.parent.testFunc()"/>


When I click the button it runs the testFunc() function which resides in the <script> tag of the chrome window. Very simple, no problems.


Here is where it gets weird... I want program to build a webpage on-the-fly and load/write it into the iframe. So I have this code in the javascript of my chrome window:


var doc = window.frames["doc"].document;
doc.open( );
doc.write("<html><body onclick="window.parent.testFunc();">Just a test sentance.</body></html>");
doc.close( );



The html page that I create is written and displayed in the iframe as expected, however if I call the function window.parent.testFunc(); from within the generated html page it gives the following error in the javascript console:



Error: uncaugth exception: premission denied to get property ChromeWindow.testFunc



This happens with any function I try to call that resides in the Chrome Window, and it only happens when the page in the iframe has been generated instead of loaded from a URL. Is there a way to get around this "security" issue? I've tried calling netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); before calling the function but then I get the error that the permission requested was refused. Help.


thanks. mawrya



Reply via email to