Join us in Outworldz at or follow us:

[Table of Contents]

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: Description: Creator:
HTML I've written an LSL script which "serves" custom-generated HTML via a neat trick I discovered. But don't bust out the champagne just yet this method is extremely limited, so I don't expect this to revolutionize HUDs or anything like that. Still, it's a fun curiosity.// The trick is this: If you use text of the form "data:text/html,[html code here]" as the web URL, Firefox (and maybe other browsers?) will render the HTML code as a web page. For example, visit data:text/html,

Oh hai!

, and Firefox will render the words 'Oh hai!'. It's not accessing a web page, and it's not loading a local HTML file, it's loading the HTML code from the pseudo-URL.// The same trick works in SL as well, by setting the parcel media URL to the "data:text/html" string. You can use an LSL script to generate the HTML code and set the parcel URL, or even set the URL for an individual avatar. The result is that your LSL script acts as a very simple web server!// However, as I mentioned, there are some serious limitations: SL won't let you set the web URL to a string longer than 254 letters! That means you have to cram all the HTML code into that tiny string, which severely limits the complexity of the HTML you can display.// Another problem is that the method may not work for other web engines besides Firefox / Mozilla. Linden Lab is (or was recently) working on switching to WebKit, the engine used by Safari, for rendering HTML. That's good news, since WebKit is some great software, but this little trick might stop working when they switch. So, I wouldn't rely on it.// So, I don't expect this method to be more than a silly toy for programmers to play around with. But it is that! And on the plus side, there are signs that we might get proper HTTP server functionality in LSL sometime in the future, which would be a great boon to many scripting industries in SL.

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