forked from wzomg/chatclient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
56 lines (55 loc) · 2.08 KB
/
index.html
File metadata and controls
56 lines (55 loc) · 2.08 KB
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
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="static/image/favicon.ico"/>
<title>chatroom</title>
</head>
<body>
<div id="app"></div>
</body>
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<script>
// browser
function myBrowser() {
const userAgent = navigator.userAgent
const isOpera = userAgent.indexOf("Opera") > -1
if (isOpera) {
return "Opera"
} else if (userAgent.indexOf("Edge") > -1) {
return "Edge"
} else if (userAgent.indexOf("Firefox") > -1) {
return "FireFox"
}
if (userAgent.indexOf("Chrome") > -1) {
return "Chrome"
} else if (userAgent.indexOf("Safari") > -1) {
return "Safari"
} else if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) { //判断是否IE浏览器
alert("球球你不要再用IE了吧(ノへ ̄、),换谷歌、火狐试试")
return "IE"
} else {
alert("球球你不要再用IE了吧(ノへ ̄、),换谷歌、火狐试试")
return "IE"
}
}
const UserAgent = navigator.userAgent
const OSInfo = UserAgent.substring(UserAgent.indexOf('(') + 1, UserAgent.indexOf(';'))
const Browser = myBrowser()
window.OSInfo = OSInfo
window.Browser = Browser
console.log(
'%c OS:' + OSInfo + ' %c Browser:' + Browser + ' %c ',
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
'background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
'background:transparent'
)
console.log(
'%c IP:' + returnCitySN["cip"] + ' %c Country:' + returnCitySN["cname"] + ' %c ',
'background:#409EFF ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
'background:#3578E5 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
'background:transparent'
)
</script>
</html>