Javascript Sandbox

Posted by Louis on Stack Overflow See other posts from Stack Overflow or by Louis
Published on 2010-06-07T03:25:40Z Indexed on 2010/06/07 3:32 UTC
Read the original article Hit count: 400

I want to have developers write some custom apps for a site in Javascript but I want to sandbox it so they can't do anything naughty like redirect the user, set the body display to none etc etc. I have a namespace in Javascript where all the functions they'll ever need exist in there so I was thinking to create a sandbox would be a matter of:

with(Namespace) {
    //App code goes here where they can only access Namespace.*
}

How is easy is it to get around this and what other methods can be done? Would rather not have to moderate every submitted app.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about sandbox