topical media & game development

talk show tell print

professional-javascript-16-LiveConnectExample.htm / htm

          <title>LiveConnect Example</title>
          <script type="text/javascript">
                  function httpGet(sURL) {
                      var sResponseText = "";
                      var oURL = new;
                      var oStream = oURL.openStream();
                      var oReader = new;
                      var sLine = oReader.readLine();
                      while (sLine != null) {
                          sResponseText += sLine + "\n";
                          sLine = oReader.readLine();
                      return sResponseText;
                  function getServerInfo() {
                          var sResponseText = httpGet("http://localhost/example.txt");
                          alert("Response text is: " + sResponseText);
          <p>Click the button to make a call to the server using LiveConnect.
          This example will only work when run in a Web server environment. You'll need
          to change the URL <code>http://localhost/example.txt> to point to a valid
          file on the server.</p>
          <input type="button" onclick="getServerInfo()" value="Get Server info" />

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.