<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hallo<div><br></div><div>Lässt sich kurz umreissen, ob/wie sich die Laufzeitumgebung für js-Scripts zwischen dem dSS und einem Browser unterscheiden?</div><div>Oder anders, gibt es Einschränkungen, bzw. Voraussetzungen, dass gegebener Code auf dem dSS laufen kann?</div><div><br></div><div><br></div><div>Konkreter:</div><div>Ziel ist, einen HTTP Get-Request auf einen Server ausserhalb des dSS abzusetzen.</div><div><br></div><div>Nach meinem (limitierten) Verständnis einfachste Methode wäre zum Beispiel:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span style="font: 12.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">        </span></span>request = new XMLHttpRequest();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span style="font: 12.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">        </span></span>request.open('GET', 'http://192.168.111.56:82/home/dss_callback.php?msg=yes');</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span style="font: 12.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">        </span></span>request.send(null);</div></div><div><br></div><div>Dieser Code in eine Webseite eingebaut funktioniert. </div><div>Die URL vom dSS aus per wget abgeschickt, funktioniert auch (es gibt also kein Netzwerkproblem).</div><div><br></div><div>Bloss in myapp.js eingebaut:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; ">var LOGFILE_NAME = "myapp.log";</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; ">var l = new Logger(LOGFILE_NAME);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; ">if (<a href="http://raisedEvent.name">raisedEvent.name</a> == "myapp.sayHello") {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "> l.logln('myapp started');</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "> l.logln('The message is: ' + raisedEvent.parameter.message);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span style="font: 12.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">        </span></span>request = new XMLHttpRequest();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span style="font: 12.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">        </span></span>request.open('GET', 'http://192.168.111.56:82/home/dss_callback.php?msg=yes');</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span style="font: 12.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">        </span></span>request.send(null);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; ">}</div><div><br></div></div></div></blockquote><div><br></div><div>erhalte ich eine Fehlermeldung:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>[Error][System] EventInterpreterPluginJavascript::handleEvent:Caught event while running/parsing script '/usr/share/dss/add-ons/myapp/myapp.js'. Message: Caught Exception while executing script: ReferenceError: <font class="Apple-style-span" color="#FC241A">XMLHttpRequest is not defined</font></div></div></blockquote><div><br></div><div>Irgendwas an der Laufzeitumgebung muss also anders sein. Namespace? Kontext? Abgespeckte Libraries?</div><div>Oder hat es mit Ext js zu tun?</div><div><br></div><div>Gruss,</div><div>Dieter</div><div><br></div></body></html>