Returns the content type based upon the provided absolute URL and content type/subtype.
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.
<?xml
version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD
WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1">
<p>
loadString
example
</p>
<do type="accept">
<go
href="LoadStringExample.wmls#findloadstring()" />
</do>
</card>
<card id="card2">
<p>
URL = $(urlstring)
<br />
content
type = $(contenttype);
<br
/>
load string = $(loadstr);
</p>
</card>
</wml>Code for LoadStringExample.wml
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);
WMLBrowser.go("LoadStringExample.wml#card2");
};
Code for LoadStringExample.wmls