Is there a way to jail in Javascript, so that the DOM isn't visible

Posted by TiansHUo on Stack Overflow See other posts from Stack Overflow or by TiansHUo
Published on 2010-04-20T08:39:54Z Indexed on 2010/04/20 8:43 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

I would really like to provide the user some scripting capabilities, while not giving it access to the more powerful features, like altering the DOM. That is, all input/output is tunneled thru a given interface. Like a kind of restricted javacsript.

Example: If the interface is checkanswer(func) this are allowed:

checkanswer( function (x,y)={
   return x+y;
}

but these are not allowed:
alert(1)
document.write("hello world")
eval("alert()")

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about restriction