Since the 3Q War 360 browser useragent has become ie, the common method of judgment is also ineffective, so have to change the way.
On page 360, press F12, pull up the debugging window, analyze the Navigator and window two objects, and finally find a value that can be used to identify 360 browsers.
<script>
if (Window.external&&window.external.twgetrunpath&&window.external.twgetrunpath (). ToLowerCase () . IndexOf ("360SE") >-1) {alert (' This site does not support 360 browser access, please change other browsers! ") ');} Else{alert (' non 360 ');}
</script>
The test results let us down.
Keep looking (The following code is available in the 360 security browsers 5 and 6 versions)
)
<script>
var check360browser={
If it's 360 browsers,
"OK": function () {
Here's the code after the 360 success.
Alert (' JS-> 360 ');
},
' TRY360SE ': function (callback) {
var ret = False,
img = new Image ();
IMG.SRC = ' res://360se.exe/2/2025 ';
Img.onload = function () {
ret = true;
}
settimeout (function () {
if (ret==true) {
Check360browser.ok ();
}else{
Ret=check360browser.try360se_2 ();
if (ret) {
Check360browser.ok ();
}
}
}, 100);
},
' Try360se_2 ': function () {
var is360 = false;
if (window.navigator.userAgent.indexOf (' Chrome ')!=-1) {
if (window.navigator.webkitPersistentStorage) {
}else{
return true;
}
}
}
}
CHECK360BROWSER.TRY360SE ();
</script>
Window.navigator members of the collection, think that should be so many members of the collection, 360 will not be achieved? The result finally found some differences, the following gives my judgment code.
<%@ page language= "java" import= "java.util.*" pageencoding= "GBK"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<base >
<title></title>
<script>
function bro () {
var is360 = false;
var Isie = false;
if (Window.navigator.appName.indexOf ("Microsoft")!=-1) {
Isie= true;
}
if (isie&& (window.navigator.userprofile+ ') = = ' null ') {
Is360 = true;
}
if (is360) {
Document.body.innerText = ' 360 browser ';
}else if (Isie) {
Document.body.innerText = ' IE browser ';
}
}
</script>
<body onload= "bro ();" >
</body>
Be careful not to forget this sentence, or you will not be able to implement the results.
[HTML] View plaincopy on code to see a snippet derived from my Code slice
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
I have used the above method in the project, the effect is OK.