javascript - Loading Jscript files into Firefox extension -


Get this problem directly:

I'm actually installing Firefox where I want to To build small chats, implement the jWebsocket API I got my main script file, named test.js , and jwsbot in the JB folder Just you know, this is my first Firefox extension.

So I found this in my XUL file (for the script part only, the interface code is not shown):

   & Lt; Script type = "app / x-javascript" src = "chrome: //test/content/js/jwebsocket.js" /> Due to being a  

jwebsocket.js file, I need to call according to the jWebsocket website.

I start with my main script file test :

  if (jws.browserSupportsWebSockets ()) {jWebSocketClient = new jws .jWebSocketJSONClient (); } Other {var lMsg = jws.msg_WS_NOT_SUPPORTED; Warning (lMsg); }  

james have namespace created in the jwebsocket.js file.

Of course I've got the required standalone server running in the background, and working.

That is why I have understood the various websites, it is that if the js file is loaded with javascript allocated memory space (with tags), then all namespaces / functions must be in each file The middle is available but it was mostly for HTML-oriented issues, so I'm not sure that it applies to the XUL / Firefox environment.

But the script fails on the first Zs call.

Any ideas on what is wrong? I am stuck for 2 days now: /

Yes, the development of HTML is the same, your Near your namespace is available between each XUL file.

Edit:

Have you initialized your browser before jumping to jws objects? WebSockets ()?

Like crazy people said, you need to load test.js after that your jwebsocket.js file.


Comments