Thursday, 1 May 2014

Script to open a website in the browser as soon as the script starts running

Script to open a website in the browser as soon as the script starts running
Shows dialog to avatar offering to load web page at url with message.
If user clicks yes, launches the page in their web browser, starting the browser if required.
• key avatar avatar UUID that is in the same region
• string message message to be displayed in the dialog box
• string url
The url is truncated to 255 characters and message is truncated to 254 characters.
The protocol for the url must be specified, currently only "https://" and "http://" are supported.
The URL should be RFC-1738 compliant with proper escapes.

default
{
    touch_start(integer num_detected)
    {
    key id = llDetectedKey(0);

        // if the touching avatar is in the same sim
        if ( llGetAgentSize(id) )
        {
          string info = "My best website!";

            // must start with either "http://..." or "https://..."
            string url = "http://www.yahoo.co.uk";

            llLoadURL(id, info, url);
        }
        else
            llInstantMessage(id, "I can open it any time!");
    }
}

No comments:

Post a Comment