360 browser to tell the truth is more evil, before the kernel can be returned by the string to determine whether to include the word "360" method to determine
As the following code
Window.navigator.userAgent.indexOf (' 360 ')!=-1
However, after 360 browser updates, the kernel displays the same string as the IE browser, which makes it impossible to determine whether IE or 360. But someone said, since is the same as the kernel of IE, do not need to determine whether it is 360 alone, I said these people stand talking not waist pain, do not know if they have written some code, found in IE and 360 browser performance behavior is not the same. Therefore, this judgment is still necessary, after everyone out of some of the way, such as writing JS to load this image ' res://360se.exe/2/2025 ', I do not know if loading this picture, is not always hanging there, I am too lazy to try this method.
Below I looked at the members of the Window.navigator collection, think of should be so many members of the collection, 360 will not be implemented? Finally, the results 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 ">
- <html>
- <head>
- <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>
- </head>
- <body onload="bro ();" >
- </Body>
- </html>
Be careful not to forget this sentence, or your execution will not be right.
- <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The above method I have used in the project, the effect is OK.
PS: The above is written a long time ago, now it is useless, now 360 browser 6.3 version, is the same as the Chrome browser kernel, not and the previous IE kernel, 360 really changed to change, the following is now modified code (written on May 30, 2014)
- <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
- <html>
- <head>
- <base >
- <title></title>
- <script>
- function bro () {
- var is360 = false;
- var isie = false;
- var isfirefox = false;
- var iscrome = false;
- var broname = ';
- if (window.navigator.userAgent.indexOf (' MSIE ')!=-1&&window.navigator.appname.indexof ("Microsoft")! =-1) {
- Isie = true;
- broname = ' IE ';
- }
- if (window.navigator.userAgent.indexOf (' Firefox ')!=-1) {
- Isfirefox = true;
- broname = ' Firefox ';
- }
- if (window.navigator.userAgent.indexOf (' Chrome ')!=-1) {
- if (window.navigator.webkitPersistentStorage) {
- iscrome = true;
- broname = ' Chrome ';
- }else{
- is360 = true;
- broname = ' 360 ';
- }
- }
- document.getElementById (' Brotype '). value=Broname;
- }
- </Script>
- </head>
- <body onload="bro ();" >
- <input type="text" id="Brotype" name="Brotype">
- </Body>
- </html>
Now please use the latest method to determine.
Use JS to identify whether 360 browsers