我想知道允许用户将JavaScript代码嵌入自己网站的最佳方法是什么
我想允许用户嵌入像fb analytic code
这样的代码,以便代码可以执行。我不希望用户嵌入恶意代码,如:
alert('foobar')
window.location = "http://foobar.com"
我尝试过以下内容:
(function(window){
delete window.alert;
delete window.location //obviously failed cause that property is not configurable
/*user define code here*/
})(window)