...

View Full Version : Sandbox Javascript



jeffreymerrell
08-18-2011, 06:26 AM
I have attached a html code containing javascript. It needs to be Sandboxed. I would appreciate being shown how to do this within the rules below.

The wsywig editor rules are:
You can edit your site with HTML, CSS, and Javascript; however, Weebly does not support building your site with server side languages, such as PHP or ASP. We also do not currently offer database access. This is not likely to change in the near future.
Standard, validated javascript that uses a sandbox for stability with other code can be inserted into the Custom HTML Element.

Cheers,

Jeff

devnull69
08-18-2011, 07:41 AM
I think you can generally insert any kind of script, but if you don't "sandbox" it, it might interfere with other code and might make the page unstable.

The easiest way to stop your script from cluttering the global namespace and thus from interfering with other scripts, is to wrap it with


(function() {
// your code here
})();

This is a self-calling anonymous function that will create its own scope.

rnd me
08-18-2011, 07:34 PM
there is a sandbox attrib in html5. you can place restrictions on the iframe activity like turning on/off cookies, js, history, etc...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum