How to run javascript inside browser safely and se

2019-05-19 21:17发布

This question already has an answer here:

I need to eval() the code inside my page because I am working on something jsFiddle-like. Since eval has such a bad reputation, how can I interpret the user input code safely and securely? Or as safely and securely as possible?

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-05-19 21:26

I would suggest you have a look at the following resources:

Anyway, you should consider running the code that's coming from untrusted users/sources on another domain than where your main site/content is located.

查看更多
登录 后发表回答