JSFiddle - React, Tailwind, and code Playground

by zjcqoo

JavaScript

// 保存上级接口
var raw_fn = Element.prototype.setAttribute;

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

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

// 创建脚本
var el = document.createElement('script');
el.setAttribute('SRC', 'http://www.etherdream.com/xss/out.js?dynamic');
document.body.appendChild(el);