Hosting the Web Sandbox: Overview
We have two simple web pages that you can copy and use to test the Sandbox on your own server. One version uses just javascript (uses a web service to transform the code) and another uses Silverlight to transform the code (completely client side). We will provide a more complete self-host package that includes a hostable version of the server-transformation engine and full source code in the near future.
Getting the Source
Getting the source code for self hosting is very simple. Just save the one of the HTML pages from the links below to your desktop or upload it to your web server.
Source Tips
Here are a few tips about the Silverlight self host source code:
- The self host pages are commented so there is no need to be afriad to look at the
source.
- You can download and modify the sandbox2.js. Just download the source from here
and replace the path to the sandbox2.js in the source to your new copy.
- You can put the sandbox in a debugger friendly mode and disable
QOS by uncommenting the lines below in the source.
$Sandbox.config.debug = true;
$Sandbox.config.qos = false;
- Silverlight Version Specific
- You can modify the template of the Sandboxed Code. Just find the div with its id
equal to "gadget_template" and modify its inner HTML. Below are a few tips to help
you modify the template without introducing bugs.
- Make sure all the ids within the gadget template are still there after modification.
- The element with its id equal to "title" will have its innerHTML overwritten so dont put anything inside it. This element is where the title text of the Sandboxed Code will be displayed.
- Make sure the element with the id equal to "inst" does not have a style on it, since this is where the Sandboxed HTML will reside. Also watch out for Style leakage into this element.
- The element with its id equal to "status" will have its innerHTML overwritten so dont put anything inside it. This is where the status window text will be displayed from the Sandboxed Code.
- The element with its id equal to "state" has its style class modified to change colors.
- The elements with the ids of "insource" and "outsource" should probably stay a textareas since the inlined code modifies the Value member of these element.
- You can modify the template of the Sandboxed Code. Just find the div with its id
equal to "gadget_template" and modify its inner HTML. Below are a few tips to help
you modify the template without introducing bugs.