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

jQuery clickable div with working mailto link inside -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -