Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Viewer 2 Bootstrapping_HTML_on_a_prim  

Bootstrapping_HTML_on_a_prim

DESCRIPTION: []::Bootstrapping_HTML_on_a_prim

Category: Viewer 2
By : Tali Rosca
Created: 2010-09-02 Edited: 2010-09-02
Worlds: Second Life

the Zip file

Download all files for Bootstrapping_HTML_on_a_prim
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Bootstrapping_HTML_on_a_prim_1.lsl
1 key url_request;
2
3 default
4 {
6 {
7 url_request = llRequestURL();
8 }
9
10 http_request(key id, string method, string body)
11 {
12 if(url_request == id)
13 {
14 url_request = "";
15 if(method == URL_REQUEST_GRANTED)
16 {
17 llSetPrimMediaParams(0, [
18 PRIM_MEDIA_CONTROLS, PRIM_MEDIA_CONTROLS_MINI,
19 PRIM_MEDIA_PERMS_CONTROL, 0,
20 PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_ANYONE,
21 PRIM_MEDIA_AUTO_SCALE, TRUE,
22 PRIM_MEDIA_AUTO_PLAY, TRUE,
23 PRIM_MEDIA_AUTO_ZOOM, FALSE,
24 PRIM_MEDIA_FIRST_CLICK_INTERACT, TRUE,
25 // If your HTML page is shorter than 1k total, you can build it completely here.
26 // This, however, contacts the prim through HTTP-in to get more data later.
27 PRIM_MEDIA_CURRENT_URL, "data:text/html," + llEscapeURL("<html><head><script src='" + body + "' type='text/javascript'></script></head><body onload='init()'></body></html>")]);
28 }
29 else if(method == URL_REQUEST_DENIED)
30 {
31 llOwnerSay("Could not get URL: " + body);
32 }
33 }
34 else
35 {
36 // This is where the full body HTML goes:
37 string content = "<div>Testing</div>";
38
39 string htmlString = "function init() {document.getElementsByTagName('body')[0].innerHTML='" + content + "';}";
40 llOwnerSay(htmlString);
41
42 llHTTPResponse(id, 200, htmlString);
43 }
44 }
45 }

Back to the Best Free Tools in Second Life and OpenSim.