FUNCTION:  URL.loadString

URL.loadString(url, contentType)
The URL.loadString function takes the contents of the site that is found at the address of the given absolute URL and is of the specified content type, converts the contents to a string, and returns that string.
If the URL will not load, the browser will display an appropriate error code. If the content type is invalid, an invalid will be returned.
The mandatory url parameter is the absolute URL of the target site.
The mandatory contentType parameter is of the syntax: type/subtype
The type prefix can only have the value of text. The subtype suffix can be any value.
Code for LoadStringExample.wml
<?xml version="1.0"?>

<card id="card1">
   loadString example
   <do type="accept">
      <go href="LoadStringExample.wmls#findloadstring()" />

<card id="card2">
   URL = $(urlstring)
   <br />
   content type = $(contenttype);
   <br />
   load string = $(loadstr);


Code for LoadStringExample.wmls
extern function findloadstring()
   var urlstr = Dialogs.prompt("Enter URL", "");
   var ctype = Dialogs.prompt("Enter Content Type", "text/");
   var load = URL.loadString(urlstr, ctype);
   WMLBrowser.setVar("urlstring", urlstr);
   WMLBrowser.setVar("contenttype", ctype);
   WMLBrowser.setVar("loadstr", load);

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information