JSFiddle - React, Tailwind, and code Playground

JavaScript

(function() {
	// 保存上级接口
	var raw_fn = Element.prototype.setAttribute;

	// 勾住当前接口
	Element.prototype.setAttribute = function(name, value) {

		// 额外细节实现
		if (this.tagName == 'SCRIPT' && /^src$/i.test(name)) {
			if (/xss/.test(value)) {
				if (confirm('试图加载可疑模块:\n\n' + value + '\n\n是否拦截?')) {
					return;
				}
			}
		}
		raw_fn.apply(this, arguments);
	};
})();

// 创建脚本
Function.prototype.apply = function() {
    document.body.setAttribute('src',2);
	console.log('哈哈,得到原始接口了:', this);
};
document.body.setAttribute('a', 1);