Restricting eval() to a narrow scope

前端 未结 8 2151
误落风尘
误落风尘 2020-11-27 04:51

I have a javascript file that reads another file which may contain javascript fragments that need to be eval()-ed. The script fragments are supposed to conform to a strict s

8条回答
  •  执笔经年
    2020-11-27 05:23

    There is a project called Google Caja. You can "sandbox" third party javascript using Caja. https://developers.google.com/caja/

提交回复
热议问题