I'm working on extension of functionality of a web browser based on Qt Webkit. The goal is to add support for some unsupported HTML5 features. I'm using qt-everywhere-opensource-src-4.8.0 distribution. The target platform is embedded.

I have a web application which I use for test purposes. Usually this application loads successfully in my browser and works fine. But from time to time I encounter such kind of error: "TypeError: 'undefined'". On all desktop browsers on which I had a chance to test this web application it works without any problems.

After some investigation I found out that these errors are related to a wrong sequence of execution of javascripts in <head> section of the main html file. I just added a debug at the beginning of each script which presents in <head> section and I got the following result:

This is part of my html file:
Qt Code:
  1. <script src="javascript/framework/icons.js"></script>
  2. <script src="javascript/framework/hnav.js"></script>
  3. <script src="javascript/framework/browserDetect.js"></script>
  4. <script src="javascript/framework/inputMgr.js"></script>
  5. <script src="javascript/framework/key.js"></script>
To copy to clipboard, switch view to plain text mode 
And here is what I have on console:
Qt Code:
  1. evaluating icons.js
  2. evaluating inputMgr.js
  3. evaluating key.js
  4. http://192.168.23.2/hnav/src/javascript/framework/key.js:188: TypeError: 'undefined' is not an object (evaluating 'Twc.browserDetect.isMoto')
To copy to clipboard, switch view to plain text mode 
So it seems that hnav.js and browserDetect.js were just skipped for some reason.

Again, usually the application loads successfully in my browser. But sometimes I face such problem and of course as a result the application is not loaded.

Thanks in advance for any help.