Below there is the skeleton of the code. Observer says "Overlay loaded
successfully" but I don't see anything. If I call the overlay directly
I get the tabbox I'm trying to add.
I've read many things about security and remote app but I didn't
understand really what's possible and what's not. Everything come from
the same remote source.
Any help?
best regards,
Lorenzo Fiorini
In the caller I have:
...
<box id="overlay" />
...
function buttonLoadOvlPressed(event)
{
var callback = {
observe : function (subject, topic, data) {
if (topic == 'xul-overlay-merged') {
alert("Overlay loaded successfully");
}
}
};
window.document.loadOverlay("http://host:8085/
overlay", callback);
}
...
document.getElementById("loadovlbutton").addEventListener('command',
buttonLoadOvlPressed, true);
...
>From the http://host:8085/overlay I get:
<?xml version="1.0"?>
<overlay id="toverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul">
<box id="overlay">
<tabbox id="Tab1" selectedIndex="2">
<tabs id="Tab1Tabs">
<tab label="A First tab"/>
<tab label="Second tab"/>
<tab label="Another tab"/>
<tab label="Last tab"/>
</tabs>
<tabpanels id="Tab1Panels">
<tabpanel><!-- tabpanel First elements go here --></
tabpanel>
<tabpanel><!-- tabpanel Second elements go here --
></tabpanel>
<tabpanel><button label="Click me"/></tabpanel>
<tabpanel><!-- tabpanel Fourth elements go here --
></tabpanel>
</tabpanels>
</tabbox>
</box>
</overlay>
I tried and failed !!!
http://test03.christophe-charron.org/public/xul/2006_09_07_tests_01/test_about_loadoverlay.html
Best regards,
Christophe Charron
> I tried and failed !!!
>
> http://test03.christophe-charron.org/public/xul/2006_09_07_tests_01/t...
Many thanks.
Is there any other method to merge controls on demand to a window?
best regards,
Lorenzo Fiorini
I don't know if it's possible for all controls but you can create a
lot of them with javascript.
Best regards,
Christophe Charron
>
> best regards,
> Lorenzo Fiorini
First, I've tried to add some script tag for XUL to load javascript. Failed.
Because this is not HTML.
And then under the instruction of Neil ,I tried loadOverlay for remote
applications and it does not work for security.
Finally, I use XHR to load the script and eval them.
> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul
>
>
--
>: ~
Best regards,
Christophe Charron
> On 8/15/07, Christophe Charron <christophe.charron....@gmail.com> wrote:
>
>
>
>
>
> > On 14 août, 17:23, LF <lorenzo.fior...@gmail.com> wrote:
> > > On Aug 14, 5:12 pm, Christophe Charron
>
> > > <christophe.charron....@gmail.com> wrote:
> > > > I tried and failed !!!
>
> > > >http://test03.christophe-charron.org/public/xul/2006_09_07_tests_01/t.
> > ..
>
> > > Many thanks.
>
> > > Is there any other method to merge controls on demand to a window?
>
> > I don't know if it's possible for all controls but you can create a
> > lot of them with javascript.
>
> > Best regards,
> > Christophe Charron
>
> > > best regards,
> > > Lorenzo Fiorini
>
> > _______________________________________________
> > dev-tech-xul mailing list
> > dev-tech-...@lists.mozilla.org
> >https://lists.mozilla.org/listinfo/dev-tech-xul
>
> --
>
> >: ~
The third one:
You must new an XHR object to fetch the script content and eval them. And
you may not get the scripts in different domains.
On 8/15/07, Christophe Charron <christophe....@gmail.com> wrote:
>
> The third one:
> You must new an XHR object to fetch the script content and eval them. And
> you may not get the scripts in different domains.
>
> Finally, I use XHR to load the script and eval them.
Sorry, I've googled for xul remote xmlhttprequest eval but I sill
can't figure it out.
Could you kindly post an example or point me to a resource?
best regards,
Lorenzo Fiorini
> Can't you use document.createElementNS(...) and ...appendChild to
> create all kind of elements in xul ?
Wouldn't we loose the "declarative" nature of XUL in this way?
best regards,
Lorenzo
Of course you can create script element in xul, but the problem is xul will
not load its' source automatically.
function callback(XHR) // callback
{
var script = XHR.responeseText; // Here is the script you got.
window.eval(script); // Now here may have a trick, make sure you are using
window.eval NOT eval, because of the variable scope problem.
}
These codes are the main work flow, you can complete it yourself. Any way,
there are still a lot of enhancement can be made, for example, a mechanism
to notify the scripts are loaded successful, maintain an array to store
which file had been loaded and ...
You'll probably want to consider evalInSandbox:
http://developer.mozilla.org/en/docs/Components.utils.evalInSandbox
> var XHR = new XMLHttpRequest();
> ...
> which file had been loaded and ...
Many thanks.
best regards,
Lorenzo Fiorini
> I tried and failed !!!
Christophe an all, sorry it was a bug in my code. I had misplaced the
box declaration position.
The code in the top post works as expected.
But why so many reports about not working xul remote? They are quite
misleading.
Is there any "official" resource about "actual" status and "future"
directions of xul platform?
However this issue has showed me that xul community is alive and gives
much help to newbies.
Many thanks again.
best regards,
Lorenzo Fiorini
> Is there any "official" resource about "actual" status and "future"
> directions of xul platform?
Have a look here but it's not about xul, just about FF :
http://wiki.mozilla.org/Firefox:Home_Page
Best regards,
Christophe Charron
> Question wrote:
>
>> var XHR = new XMLHttpRequest();
>> XHR.open('GET', script_url, false); // init;
>> XHR.onreadystatechange = function () // set callback, you can also use
>> onload
>> {
>> ... // if readyState = 4 && status == 200 then do your callback
>> here, for
>> example, callback(XHR);
>> }
>> XHR.send(''); // if method == "POST" set post data here;
>>
>> function callback(XHR) // callback
>> {
>> var script = XHR.responeseText; // Here is the script you got.
>> window.eval(script); // Now here may have a trick, make sure you
>> are using
>> window.eval NOT eval, because of the variable scope problem.
>> }
>
> You'll probably want to consider evalInSandbox:
Doubtful, as he's remote XUL loading his own scripts from his own site.
--
Warning: May contain traces of nuts.
> Do you mean that remote overlay works ?
> Could I see a full code example ?
...
<button id="loadovlbutton" label="LoadOvl"/>
<box id="overlay" />
...
function buttonLoadOvlPressed(event)
{
// Load an overlay file
var callback = {
observe : function (subject, topic, data) {
if (topic == 'xul-overlay-merged') {
alert("Overlay loaded successfully");
}
}
};
// Load the current file as an overlay
window.document.loadOverlay("http://intranethost:
8085/overlay", callback);
}
...
I'm evaluating xul and I'm working inside my intranet with Linux and
Windows hosts.
Neil, do you mean that it will not work if I'll move the code on
another domain?
best regards,
Lorenzo Fiorini
> I suppose I didn't understand everything in your code, but it doest
> work with me. Is all the code here ?
> Best regards
Do you mean it works also from a different domain?
best regards,
Lorenzo Fiorini
It doesn't work at all !!!
> It doesn't work at all !!!
Sorry I read "doest" as "does" instead of "doesn't".
I use a custom made http application server so I can't post exactly
the code I use but here are the "responses" to the browser:
Simply replacing http://<%cHost%>/overlay should work. I use
application/vnd.mozilla.xul+xml mime type for demo3 and text/xml for
overlay.
I've tested it with Fedora Core 7 using FireFox 2.0.0.5 and with a
Windows XP Home notebook using FireFox 2.0.0.6.
best regards,
Lorenzo Fiorini
demo3 remote procedure:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="demo3" title="Demo3" sizemode="maximized"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul">
<button id="loadovlbutton" label="LoadOvl"/>
<box id="overlay" />
<script>
function buttonLoadOvlPressed(event)
{
// Load an overlay file
var callback = {
observe : function (subject, topic, data) {
if (topic == 'xul-overlay-merged') {
alert("Overlay loaded successfully");
document.getElementById("clickbutton").addEventListener('command',
buttonClickPressed, true);
}
}
};
// Load the current file as an overlay
window.document.loadOverlay("http://<%cHost%>/overlay",
callback);
}
function buttonClickPressed(event)
{
alert("clicked!");
}
document.getElementById("loadovlbutton").addEventListener('command',
buttonLoadOvlPressed, true);
</script>
</window>
calling http://<%cHost%>/overlay this code is sent:
<?xml version="1.0"?>
<overlay id="toverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul">
<box id="overlay">
<tabbox id="Tab1" selectedIndex="2">
<tabs id="Tab1Tabs">
<tab label="A First tab"/>
<tab label="Second tab"/>
<tab label="Another tab"/>
<tab label="Last tab"/>
</tabs>
<tabpanels id="Tab1Panels">
<tabpanel><!-- tabpanel First elements go here --></
tabpanel>
<tabpanel><!-- tabpanel Second elements go here --
></tabpanel>
<tabpanel><button id="clickbutton" label="Click me"/
A complete example here :
http://test03.christophe-charron.org/public/xul/2007_08_22/demo3.xul
Best regards,
Christophe Charron
On 8/22/07, Christophe Charron <christophe....@gmail.com> wrote:
>
> On 21 août, 19:35, LF <lorenzo.fior...@gmail.com> wrote:
> > On Aug 21, 6:46 pm, Christophe Charron
>
>
>
> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul
>
> --
> >: ~
heu ... this one works with both xul and php made overlays
http://test03.christophe-charron.org/public/xul/2007_08_22/demo3.xul
Doesn't it work for you ?
--
Best regards,
Christophe Charron
> On 8/22/07, Christophe Charron <christophe.charron....@gmail.com> wrote:
>
>
>
> > On 21 août, 19:35, LF <lorenzo.fior...@gmail.com> wrote:
> > > On Aug 21, 6:46 pm, Christophe Charron
>
> > _______________________________________________
> > dev-tech-xul mailing list
It don't work here:
Windows. FF 2.0.0.6
load php overlay and load js overlay generate the protection error