Hi Skar,

I'm not the expert for the boot loader from qooxdoo, but I will try my best ;-)

I think, I have found the reason why the application is not loaded with Firefox. The qooxdoo script loader sets a DOM ready flag for FF, which isn't set when the application is loaded like you do.

You can add this workaround to your source code to run it with your build application on script load:
<code>
// ...
<script type="text/javascript">
if (!window.qx) window.qx = {};
var fireContentLoadedEvent = function() {
qx.$$domReady = true;
document.removeEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
};
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
}

//<![CDATA[
window.onload =
// ...
</code>

This code is a copy from qooxdoo script loader and sets the DOM ready flag for Firefox.

I haven't tested it, but I think now it works with all Browsers.

Cheers,
Chris

Am 21.12.2009 12:00, schrieb skar:
Hi,

I used the following html to serve a qooxdoo app. It works fine in
chrome, but doesn't work in ff 3.5. Basically, I'm trying to show a
progress text for the qooxdoo build js file. The file is fetched ok and
when I add the js node, it works fine in chrome, but in ff, nothing
happens and no errors/warnings in firebug.

Any one know where I'm going wrong?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en-us">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>testproject</title>
   <script type="text/javascript">
     //<![CDATA[
     window.onload =

       //load the js now
       function() {
         var app_js = "/testproject/build/script/testproject.js";
         var head = document.getElementsByTagName('head')[0];
         var body = document.getElementsByTagName("body")[0];
         var progress = document.getElementById('progress');
         var nojs = document.getElementById("nojs");
         var js_app = "";
         var js_element;
         var cur_size = 0;
         var js_req = new XMLHttpRequest();
         var percent = 0;
         var js = 0;
         var size = 0;
         var progress_text = "";

         js_req.open("GET", app_js, true);
         js_req.onreadystatechange = function() {
           //3, the partial progress state will occur more times, so
check it first
           if (js_req.readyState == 3)  {
             cur_size = js_req.responseText.length || 0;
             if(size == 0){
               size =
parseInt(js_req.getResponseHeader("Content-Length")) || 0;
               console.log("App size is " + size + " ...");
             }
             percent = parseInt(cur_size/size * 100);
             progress_text  = "App loaded " + percent + "% " + cur_size
+ " of " + size + " bytes ...";
             //console.log("Current progress text content is: " +
progress.textContent + " ...");
             progress.textContent = progress_text;
             return;
           } else if(js_req.readyState == 4)  { //4 means complete
             if(size == 0){
               size =
parseInt(js_req.getResponseHeader("Content-Length")) || 0;
               console.log("App size is " + size + " ...");
             }
             console.log("App load request completed with status " +
js_req.status + " ...");
             clearTimeout(jsTimer);
             if (js_req.status == 200)  {
               console.log("Fully loaded app " + cur_size + " of " +
size + " bytes ...");
               //remove the progress div
               body.removeChild(progress);
               body.removeChild(nojs);
               js_app = js_req.responseText;
               js_element = document.createElement('script');
               js_element.type = 'text/javascript';
               js_element.text = js_app;
               js_element.id = "dyn_js"
               //js_element.src = app_js;
               head.appendChild(js_element);
               //res = eval(js_app);
               //console.log("Eval res is " + res + " ...");
               return;
             } else { //loaded part
               console.log("Error in loading js!!! Status is:" +
js_req.status + " ...");
               return;
             }
           } else { //not complete yet
             return;
           } //else part
         };
         console.log("Sending app request ...");
         var jsTimer = setTimeout(function() {
           console.log("Aboring app loading request due to time out!!!");
           js_req.abort();
         }, 10000);
         js_req.send(); //send it, NOW
       }
       //]]>
   </script>
   </head>
<body>
   <div id="nojs">
     <!--
     <noscript>
       <center><b>Javascript disabled or not supported!!! Please enable
javascript in your browser!!!</b></center>
     </noscript>
     -->
   </div>
   <div id="progress">Loading application ...</div>
</body>
</html>
cheers,
skar.



--
Christian Schmidt
Software Entwickler

1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
schmidt.christ...@1und1.de

Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas 
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver 
Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to