How detect if a webpage is opened by XUL <browser> tag?

100 Views Asked by At

I created this XUL application

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>

<window title="example"
        xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        width="800px"
        height="500px">
    <vbox flex="1">
        <browser flex="1" type="content" src="http://localhost/page.html" />
    </vbox>
</window>

For run I use Firefox command:

firefox -app application.ini

In firefox 48 it was possible to detect using JavaSCript with this:

if (parent !== window) {
    alert("Opened by <browser> or <iframe>");    
}

But in Firefox 57 not work.

I would like to know if it is possible to detect it anyway, using JavaScript or CSS (maybe some @media query).

0

There are 0 best solutions below