您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 和田分类信息网,免费分类信息发布

用JavaScript如何找到网页浏览器的名称和版本?

2024/6/7 17:32:09发布68次查看
要查找网络浏览器的名称和版本,您需要尝试以下代码 -
示例<html> <head> <title>browser detection example</title> </head> <body> <script> <!-- var useragent = navigator.useragent; var opera = (useragent.indexof('opera') != -1); var ie = (useragent.indexof('msie') != -1); var gecko = (useragent.indexof('gecko') != -1); var netscape = (useragent.indexof('mozilla') != -1); var version = navigator.appversion; if (opera) { document.write("opera based browser"); // keep your opera specific url here. } else if (gecko) { document.write("mozilla based browser"); // keep your gecko specific url here. } else if (ie) { document.write("ie based browser"); // keep your ie specific url here. } else if (netscape) { document.write("netscape based browser"); // keep your netscape specific url here. } else { document.write("unknown browser"); } // you can include version to along with any above condition. document.write("<br /> browser version info : " + version ); //--> </script> </body></html>
以上就是用javascript如何找到网页浏览器的名称和版本?的详细内容。
和田分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录