如何做到识别360浏览器?
如题,我有一个网站 dddddgz.github.io,然后 360 浏览器访问网站会“出现问题”,所以我打算识别 360 浏览器,并且使用 Cookie 禁止 360 浏览器通过插件更改 User-Agent 来访问UserAgent有问题
仅供参考,你试试吧
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('360se') !== -1 || userAgent.indexOf('360ee') !== -1) {
// 是 360 浏览器,执行相应操作,如设置 Cookie 或拒绝访问
} liuhongrun2022 发表于 2023-7-26 10:12
仅供参考,你试试吧
liuhongrun2022 发表于 2023-7-26 10:12
仅供参考,你试试吧
360:你当我傻吗
确实是
360:我又不是傻:
https://www.cnblogs.com/chiangchou/p/test-360.html#:~:text=%E5%9C%A8%E5%85%B6%E5%AE%83%E5%9F%9F%E5%90%8D%E4%B8%8B%E6%A3%80%E6%B5%8B%EF%BC%8CuserAgent%E8%BF%94%E5%9B%9E%E7%9A%84%E5%85%A8%E6%98%AF%E5%8E%9F%E7%94%9F%E7%9A%84%E8%B0%B7%E6%AD%8C%E6%B5%8F%E8%A7%88%E5%99%A8%E7%9A%84userAgent%EF%BC%8C%E8%80%8C%E5%9C%A8360%E7%9B%B8%E5%85%B3%E5%9F%9F%E5%90%8D%E4%B8%8B%E5%B0%B1%E5%90%AB%E6%9C%89360%E8%87%AA%E5%B7%B1%E7%9A%84%E6%A0%87%E8%AF%86%E3%80%82%20%E6%89%80%E4%BB%A5%E7%8E%B0%E5%9C%A8%E6%83%B3%E8%A6%81%E9%80%9A%E8%BF%87userAgent%E6%9D%A5%E6%A3%80%E6%B5%8B360%E6%98%AF%E6%A3%80%E6%B5%8B%E4%B8%8D%E5%87%BA%E6%9D%A5%E7%9A%84%E3%80%82%20360%E6%9B%B4%E6%94%B9%E4%BA%86UserAgent%E4%B9%8B%E5%90%8E%EF%BC%8C%E6%97%A0%E6%B3%95%E4%BB%8E%E7%94%A8%E6%88%B7%E4%BB%A3%E7%90%86%E8%AF%86%E5%88%AB%E4%BA%86%EF%BC%8C360%E6%B5%8F%E8%A7%88%E5%99%A8%E5%88%B0%E4%BA%868%EF%BC%88%E5%AE%89%E5%85%A88%E5%92%8C%E6%9E%81%E9%80%9F8%EF%BC%89%E4%BB%A5%E5%90%8E%EF%BC%8C%E7%89%88%E6%9C%AC%E5%8F%B7%E9%9A%8F%E7%9D%80Chrome%E8%80%8C%E5%8D%87%E7%BA%A7%EF%BC%8C%E9%9A%BE%E4%BB%A5%E5%88%A4%E6%96%AD%E4%BA%86%E3%80%82,%E7%BD%91%E4%B8%8A%E5%85%B6%E5%AE%83%E7%9A%84%E6%96%B9%E5%BC%8F%E6%B5%8B%E8%AF%95%E5%87%A0%E4%B9%8E%E9%83%BD%E4%B8%8D%E8%A1%8C%EF%BC%8C%E5%B0%B1%E4%B8%8D%E5%86%99%E5%87%BA%E6%9D%A5%E4%BA%86%E3%80%82%20%E5%81%B6%E7%84%B6%E9%97%B4%E5%8F%91%E7%8E%B0%E4%B8%80%E4%B8%AA%E5%8F%AF%E4%BB%A5%E5%88%A4%E6%96%AD%E6%98%AF360%E6%B5%8F%E8%A7%88%E5%99%A8%E7%9A%84mimeType%20%28%E5%AA%92%E4%BD%93%E7%B1%BB%E5%9E%8B%29%EF%BC%8Ctype%3A%20%22application%2Fvnd.chromium.remoting-viewer%22 zsy0226 发表于 2023-7-26 12:30
360:我又不是傻:
https://www.cnblogs.com/chiangchou/p/test-360.html#:~:text=%E5%9C%A8%E5%85%B6%E5% ...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>浏览器检测</title>
</head>
<script>
window.onload = function () {
//application/vnd.chromium.remoting-viewer 可能为360特有
var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
console.log(is360);
if (isChrome() && is360) {
alert("检测到是360浏览器");
}
}
//检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
function isChrome(){
var ua = navigator.userAgent.toLowerCase();
return ua.indexOf("chrome") > 1;
}
//测试mime
function _mime(option, value) {
var mimeTypes = navigator.mimeTypes;
for (var mt in mimeTypes) {
if (mimeTypes == value) {
return true;
}
}
return false;
}
</script>
<body>
</body>
</html>
歌者文明清理员 发表于 2023-7-26 12:36
az
页:
[1]