forked from yunfeihuang/vx-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (45 loc) · 1.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<meta name="x5-orientation"content="portrait">
<meta name="screen-orientation"content="portrait">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>Vx UI示例</title>
<style type="text/css">
body{
padding:0;
margin:0;
background:#f7f7f7;
overflow:hidden;
}
</style>
<script>
if (navigator.userAgent.indexOf('Trident') > -1) {
document.writeln("<script type=\"text/javascript\" src=\"http://libs.cdnjs.net/babel-polyfill/6.0.14/polyfill.min.js\"><\/script>");
}
// 保存原有接口
var old_setAttribute = Element.prototype.setAttribute;
// 重写 setAttribute 接口
Element.prototype.setAttribute = function(name, value) {
// 匹配到 <script src='xxx' > 类型
if (this.tagName == 'SCRIPT' && /^src$/i.test(name)) {
var node = document.createElement('a')
node.href = value
if (node.host != location.host) {
console.log('拦截可疑模块:', name, value)
return;
}
}
// 调用原始接口
old_setAttribute.apply(this, arguments);
};
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>