Javascript Sandbox? -


would possible sandbox user-submitted javascript overriding various functions such alert, window.location, , eval?

i'm not looking perfect solution. i'm sure people still find way rearrange divs spell out swear words or malicious, if disable page redirects 100% reliably happy.

i tried in chrome, , doing like

context={}; //use prevent `this` being `window` context.f=function(){   var window=null,location=null,eval=function(){};   console.log(window); //also other 2 }; context.f(); 

seems promising. if replace console line user-submitted code (checking paren balancing), absurdly bad idea or mildly bad idea? on chrome can still break things going through this function , redefining things, acceptable me.

you can use microsoft web sandbox or google caja.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -