[XulRunner] Problem with browser element

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[XulRunner] Problem with browser element

GMouron
Hi,

I already asked my question there https://forums.mozilla.org/addons/viewtopic.php?f=7&t=9930
, but someone advised me to ask my question on this group.
I hope it's the right place. My post will be mostly a copy/paste of
the post in the mozilla forums.

I am trying to build an application based on XulRunner. This
application will need to display some html pages so I want to use the
browser element (https://developer.mozilla.org/en/XUL/browser)
However it does not seem to work. Here is my very simple code :

main.xul :

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

<window id="main" title="This is my app" width="500" height="500"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
        <browser src="http://www.mozilla.org" type="content-primary" />
</window>

When I try to start the application (using Firefox as XulRunner), I
get this :

Gmo:MyApp gmo$ /Applications/Firefox.app/Contents/MacOS/firefox -app /
Users/gmo/code/MyApp/application.ini -purgecaches
2012-05-16 20:37:12.445 firefox[5798:903] invalid drawable

I'm running with Firefox 13 on Mac OS X Snow Leopard. I have the same
result on Firefox 13 with WIndows XP (albeit no error message, just a
blank window)
Note that if I replace the browser by an iframe, the page is correctly
dislayed.

Any ideas ?

Thanks
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: [XulRunner] Problem with browser element

Neil-4
GMouron wrote:

> <browser src="http://www.mozilla.org" type="content-primary" />
>
Does adding flex="1" to the browser make any difference?

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Problem with browser element

reverendlinux
On May 20, 4:52 pm, Neil <[hidden email]> wrote:
> GMouron wrote:
> >    <browser src="http://www.mozilla.org" type="content-primary" />
>
> Does adding flex="1" to the browser make any difference?
>
> --
> Warning: May contain traces of nuts.

I was able to get it working with some caveats.  The only way I could
get the browser to display was in a straight dialog or window element
with no container.  Placing the browser element in an iframe or vbox
would cause the src to not be displayed.  Hope that's clear.  For
example this code works:

<dialog
        title="Browser"
        onload="window.resizeTo(screen.availWidth,screen.availHeight);"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        style="background-color: white;">

        <browser src="http://www.mozilla.org" type="content" flex="1" />

</dialog>


But this code does not:

<dialog
        title="Browser"
        onload="window.resizeTo(screen.availWidth,screen.availHeight);"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        style="background-color: white;">

        <vbox>
             <browser src="http://www.mozilla.org" type="content" flex="1" />
        </vbox>

</dialog>

This was tested using XULRunner 12.0 on Fedora 16.

On another note, I remember reading somewhere that it's better
security practice to call the local system's browser versus using the
browser element when displaying external sites.  Is that still true?
Was it ever true?
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Problem with browser element

Neil-4
reverendlinux wrote:

>this code does not:
>
><dialog
> title="Browser"
> onload="window.resizeTo(screen.availWidth,screen.availHeight);"
> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
> style="background-color: white;">
>
>        <vbox>
>     <browser src="http://www.mozilla.org" type="content" flex="1" />
>        </vbox>
>
></dialog>
>  
>
Try it with <vbox flex="1">.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Problem with browser element

reverendlinux
On May 28, 3:08 pm, Neil <[hidden email]> wrote:

> reverendlinux wrote:
> >this code does not:
>
> ><dialog
> >    title="Browser"
> >    onload="window.resizeTo(screen.availWidth,screen.availHeight);"
> >    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
> >    style="background-color: white;">
>
> >        <vbox>
> >         <browser src="http://www.mozilla.org" type="content" flex="1" />
> >        </vbox>
>
> ></dialog>
>
> Try it with <vbox flex="1">.
>
> --
> Warning: May contain traces of nuts.

Okay, that worked.  So why is flex="1" needed in both elements?

_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Problem with browser element

Neil-4
reverendlinux wrote:

>So why is flex="1" needed in both elements?
>  
>
The default size of a <browser>, <vbox> or <hbox> is 0x0. So you need to
do something to get them to take up space in the window. In your case of
a <browser> inside a <vbox>, you need to make the <vbox> take up space
in the window, which then gives you the chance to make the <browser>
take up space in the <vbox>.
Now for horizontal space you don't actually need to do anything as both
<window> and <vbox> will by default stretch their children to their own
width, so the <browser> is already the correct width. (You can if
necessary modify this using the align attribute.) However, you still
need to do something about the height of the browser. The flex="1" on
the browser will make it consume all the "spare" height of the <vbox>,
but that assumes that it has some to spare. To achieve this, you also
need to add flex="1" to the <vbox>, so that it will consume all the
spare height of the window.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul