Difference between revisions of "Shared Media and data URIs"

From Second Life Wiki
Jump to navigation Jump to search
Line 13: Line 13:
# Click the '''Generate''' button.
# Click the '''Generate''' button.
# Copy the ''full'' data: URI in your web browser's address bar. It should look like this: <code><nowiki>data:text/html;charset=utf-8,<!DOCTYPE HTML PUBLIC "-%2F%2FW3C%2F%2FDTD HTML 4.0%2F%2FEN">%0D%0A<html lang%3D"en">%0D%0A <head>%0D%0A  <title>Test<%2Ftitle>%0D%0A  <style type%3D"text%2Fcss">%0D%0A  <%2Fstyle>%0D%0A <%2Fhead>%0D%0A <body>%0D%0A  <p>This is a test!<%2Fp>%0D%0A <%2Fbody>%0D%0A<%2Fhtml>%0D%0A</nowiki></code>
# Copy the ''full'' data: URI in your web browser's address bar. It should look like this: <code><nowiki>data:text/html;charset=utf-8,<!DOCTYPE HTML PUBLIC "-%2F%2FW3C%2F%2FDTD HTML 4.0%2F%2FEN">%0D%0A<html lang%3D"en">%0D%0A <head>%0D%0A  <title>Test<%2Ftitle>%0D%0A  <style type%3D"text%2Fcss">%0D%0A  <%2Fstyle>%0D%0A <%2Fhead>%0D%0A <body>%0D%0A  <p>This is a test!<%2Fp>%0D%0A <%2Fbody>%0D%0A<%2Fhtml>%0D%0A</nowiki></code>
# Using the steps described here, paste that exact URI into Shared Media on a prim.
# Using the steps described in '''[Adding_Shared_Media_to_an_object Adding Shared Media to an object]''', paste that exact URI into Shared Media on a prim.
# The result should look like this:
# The result should look like this:



Revision as of 10:26, 15 March 2010

Data: URIs can be used with Shared Media. If you're not a geek, why should you care?

In short, one possible use is: say you have some content you want to show on a prim face, but you don't want to go through the trouble of creating an HTML file and uploading it to a webserver. (Or, you don't have a server.)

You can use a data: URI tool to convert web content into a long link you can paste into Shared Media. It saves time and trouble.

Here's a simple example:

  1. In your web browser, go to The data: URI kitchen. This is an easy tool to convert HTML into a data: URI.
  2. Change <p></p> to <p>This is a test!</p>
  3. Click the Generate button.
  4. Copy the full data: URI in your web browser's address bar. It should look like this: data:text/html;charset=utf-8,<!DOCTYPE HTML PUBLIC "-%2F%2FW3C%2F%2FDTD HTML 4.0%2F%2FEN">%0D%0A<html lang%3D"en">%0D%0A <head>%0D%0A <title>Test<%2Ftitle>%0D%0A <style type%3D"text%2Fcss">%0D%0A <%2Fstyle>%0D%0A <%2Fhead>%0D%0A <body>%0D%0A <p>This is a test!<%2Fp>%0D%0A <%2Fbody>%0D%0A<%2Fhtml>%0D%0A
  5. Using the steps described in [Adding_Shared_Media_to_an_object Adding Shared Media to an object], paste that exact URI into Shared Media on a prim.
  6. The result should look like this:

Feel free to use more advanced code to gain familiarity.

What's the difference between a URI and a URL?

This gets fairly technical, but "URL vs. URI vs. URN, in More Concise Terms" has a good explanation.