How to open a new window from XUL Browser?

I am wondering if it is possible to process the request for the Xul Browser component to open a new window? I tried to change the window.open function, but it looks like it never called. All links that open in a new window do not open in my application.

I found this page on this subject, but the solution provided does not show any other behavior.

Any hint of this?

(by the way, I'm developing a standalone application, not an extension for Firefox)

+4
source share
3 answers

I assume that you are in the XULRunner application and are trying to download the chrome URL from a non-chrome source in the browser (e.g. HTTP or local file). Although including UniversalXPConnect and UniversalBrowserWrite can be useful, they also pose a security risk (since any arbitrary scripts on the Internet can use them), so they are usually disabled in browsers (for example, running this line in Firebug will give you an exception):

>>> netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite"); Error: A script from "http://stackoverflow.com" was denied UniversalXPConnect UniversalBrowserWrite privileges. 

How about how you try to use security principles for codebase and do you see it that matters? (Http://www.mozilla.org/projects/security/components/signed-scripts.html#codebase). For me in Firebug, this allows me to get additional permissions after I'm OK with a large, nasty dialog box), but still does not allow me to open the Chrome URL using window.open. The next step is probably an attempt to modify the conf file to use contentaccessible so that the accessible portion of your content is available (see https://developer.mozilla.org/en/Chrome_Registration#contentaccessible ).

To avoid unpleasant messages when increasing permissions, you can try to automatically set permissions for the correct files, as described in http://forums.mozillazine.org/viewtopic.php?f=38&t=1769555 .

Also, make sure you check your browser type (https://developer.mozilla.org/en/XUL/Attribute/browser.type). If the browser type is not chrome plated, then it might be worth a try to make it chrome and see if it matters.

If any of my assumptions is wrong, come back to me and I will try something else.

+1
source

Does normal js work?

 window.open(url,windowname,flags); 
0
source

There are two ways that I know of.

First, set the browser.chromeURL parameter to a chrome URL containing <browser type="content-primary"> . The page that the search box is trying to open will load into this browser.

The second task is to set the window.browserDOMWindow property with the object that you define to implement the nsIBrowserDOMWindow interface. This allows you to redirect an open call to a tab if you use a tabbed interface. Note. Tabbed preferences must be configured so that windows are redirected to tabs, otherwise XULrunner will return to browser.chromeURL .

0
source

All Articles