-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
53 lines (50 loc) · 2.06 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
47
48
49
50
51
52
53
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title id="ip"></title>
<meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, maximum-scale = 1.0, minimum-scale=1.0,initial-scale=1.0">
<style>
body {
margin: 0;
padding: 0;
}
iframe {
border: none; /* 去除边框 */
margin: 0;
padding: 0;
}
</style>
<script>
function changeIframeSrc() {
var browserType = navigator.userAgent; //获取浏览器类型
var iframe = document.getElementById("myiframe"); //获取iframe标签
if (browserType.indexOf("Edg") > -1) {
iframe.src = "epage.html"; //如果是edge浏览器,嵌入e网页
}
else if (browserType.indexOf("Chrome") > -1) {
iframe.src = "cpage.html"; //ua如果是chrome浏览器,嵌入c网页
}
else if (browserType.indexOf("Firefox") > -1) {
iframe.src = "fpage.html"; //ua如果是firefox浏览器,嵌入f网页
}
else if (browserType.indexOf("Trident/7") > -1 && browserType.indexOf("rv:11") > -1 ) {
iframe.src = "https://www.bing.com"; //如果是IE10浏览器,嵌入Bing网页
}
else if (browserType.indexOf("compatible") > -1 && browserType.indexOf("MSIE") > -1 ) {
iframe.src = "https://www.bing.com"; //如果是IE10浏览器,嵌入Bing网页
}
else if (browserType.indexOf("MicroMessenger") > -1) {
iframe.src = "Mpage.html"; //ua如果是微信,嵌入f网页
}
else {
iframe.src = "https://vdse.bdstatic.com//192d9a98d782d9c74c96f09db9378d93.mp4"; //如果是其他类型的浏览器,嵌入rickroll网页
}
}
document.getElementById("ip").innerText = window.location.hostname;
</script>
</head>
<body onload="changeIframeSrc()"> <!-- 在页面加载时调用函数 -->
<iframe id="myiframe" title="My Iframe" height="100%" width="100%" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0;"></iframe> <!-- 创建内联框架,并设置id属性 -->
</body>
</html>