Browser Protocol Handler

From OpenSimulator

Jump to: navigation, search

A browser-protocol handler is a quick way to connect to a grid, by just clicking on a hyperlink that has an "opensim://" prefix, The only thing you have to do, is instruct your browser how to handle the sl-viewer. Currently there are protocol-handlers for Linux and Windows. I'm pretty sure it's just as easy on the Mac, but since I don't own one, you have to find out for yourself(for now).

Linux - Firefox

You can setup firefox to open opensim://serveraddress links, so you don't have to specify the login-parameters every time you're connecting.

Follow these steps in order to use this functionality:

  • create a file named osurl.sh in your secondlife directory, and fill with:
#!/bin/sh 
exec= kdesu -c "/your/path/to/secondlife/secondlife -loginuri ${1:10} -loginpage ${1:10}/?method=login"

Notice that kdesu is optional. Install on console kdesu $sudo apt-get install kdesudo

Somehow secondlife crashes when i run it as a normal user, so I run it as root.

  • Make the file executable
chmod +x ./osurl.sh

Next you have to add a protocol handler to firefox, so firefox knows that it should run this shellscript.

  • Enter about:config in your browser
  • Add a new string, name it "network.protocol-handler.app.opensim"
  • Enter /path/to/your/secondlife/dir/osurl.sh as value
  • Add a new boolean, name it "network.protocol-handler.external.opensim", and set it to "true"

Now you can try to connect with the OS-Grid by opening "opensim://osgrid.org:8002"" in your browser. Please notice that using protocol handlers may cause a potential security hazard(http://www.heise-security.co.uk/news/96163). I am not sure whether this script is vulnerable to the -autologin vulnerability, so be warned(ps. I don't take any responsibility for using this script).

Windows - Internet Explorer

You can do the same for windows, but it takes a little more work. Follow these steps to get the functionality:

  • create a file named osurl.bat in your secondlife directory, and fill with:
@echo off > osurl.bat
SET rawUrl=%1
SET cleanUrl=%rawUrl:~10%
START "OpenSim" /HIGH /B "%~d0%~p0SecondLifeWindLight.exe" -loginpage %cleanUrl%?method=login -loginuri %cleanUrl%
EXIT
  • We need to create a file named opensim.reg, fill with(modify paths to SL if needed) the text beneath, and save:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\opensim]
"(default)"="URL:opensim"
"URL Protocol"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\opensim\DefaultIcon]
@="\"C:\\Program Files\\SecondLifeWindLight\\osurl.bat\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\opensim\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\opensim\shell\open]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\opensim\shell\open\command]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\opensim\shell\open\command]
@="\"C:\\Program Files\\SecondLifeWindLight\\osurl.bat\" %1"
  • Right-click the file, and import it to the registry

Windows - Firefox

  • Follow the previous steps for Internet explorer
  • add a protocol handler to firefox, so firefox knows that it should run this shellscript.
  • Enter about:config in your browser
  • Add a new string, name it "network.protocol-handler.app.opensim"
  • Enter c:/Program Files/YourSecondLifedir/osurl.bat as value (use your own sl-path here)
  • Add a new boolean, name it "network.protocol-handler.external.opensim", and set it to "true"

Now try to connect with the OS-Grid by clicking this link in your browser: opensim://osgrid.org:8002""

Mac OSX

There are two ways to do this, one is by making a file with shell commands in it as follows:

make a file called 'opensim-client.sh'

Using your favorite editor, put this line in:

/Applications/Second\ Life.app/Contents/MacOS/Second\ Life -loginuri http://osgrid.org:8002/ -loginpage http://osgrid.org/loginscreen.php

be sure to hit 'RETURN' to put the cursor on the next line.

Close and save the file.

Then, on the command line, type this:

chmod +x opensim-client.sh

Now you are ready to connect to osgrid.org! (you may modify the URL information for the grid of your choice.

For localhost, just put in http://localhost/ instead, and leave out the '-loginpage http://osgrid.org/loginscreen.php information.

The second way to do that is to copy the above and paste it on a shell prompt and hit enter!

Enjoy!

Example URLs

Setup the protocol handler for convenient connecting, or use the same syntax for other Grids. After the protocol handler is setup, you can try to connect to some grids, by clicking on of the examples below:

opensim://user.deepgrid.com:8002/

opensim://osgrid.org:8002/

opensim://logingrid.net:8002/

opensim://maingrid.centralgrid.com:8002/

opensim://eu-grid.eu:8002/

Personal tools
General
About This Wiki