using of javascript

Go look in the YUI Text Editor example that’s included with the WebSDK.

thanks, but why are these examples ( webSDK ) not per default available at the xojo examples at opening :slight_smile: ( I moved it now )

LoadLibraries(“alert(‘loaded’);”,“http://glyps.on-rev.com/strophe.js”)
dim c as string
c = c + " function rawInput (data) { RS.triggerServerEvent(’" + Self.ControlID + “’,‘oRawInput’, [ data] );}”
c = c + " function rawOutput (data) { RS.triggerServerEvent(’" + Self.ControlID + “’,‘oRawOutput’, [ data] );}”
c = c + " var conn = new Strophe.Connection(‘http://192.168.83.228:7070/http-bind/’);"
ExecuteJavaScript©

so i get my callback “loaded”, but I still cannot use functions or objects in the strophe.js

Could not execute returned javascript: Can’t find variable: Strophe
Source: var langdir = document.getElementsByTagName(‘body’)[0]; if(langdir) { langdir.removeAttribute(‘dir’); }
var langdir = document.getElementsByTagName(‘body’)[0]; if(langdir) { langdir.setAttribute(‘lang’,‘de-de’); }

I tried it also with a simple javascript function in a other *.js file, also the same behavior

–> not so important as it works from the app.htmlheader

First of all, the WebSDK examples are incomplete and meant to be examples of how parts of the WebSDK works. A beginning user would probably get very frustrated With them.

As for your code… The LoadLibraries function runs in JavaScript asynchronously. The code that you have after the LoadLibraries call to “new Strophe.connection” needs to wait until the callback runs. Try putting that code into a function and call that instead of the alert.

By the way, you should read the section of the WebSDK docs on Namespaces. You cannot create and use global functions (like you have done for rawinput and rawoutput).

I understand the frustrating :slight_smile: , but the help in this forum is very good !

Thank you, I will go into it !