Web Analytics Made Easy -
StatCounter Sandbox Javascript - CodingForum


No announcement yet.

Sandbox Javascript

  • Filter
  • Time
  • Show
Clear All
new posts

  • Sandbox Javascript

    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.


    Attached Files

  • #2
    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.


    • #3
      there is a sandbox attrib in html5. you can place restrictions on the iframe activity like turning on/off cookies, js, history, etc...
      Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com