objet navigateur

objet navigateur

  • appName : nom du logiciel de navigation, principalement utilisé pour déterminer le navigateur principal utilisé par le client.

S'il s'agit d'un navigateur IE, la valeur de retour est : Microsoft Internet Explorer

S'il s'agit d'un navigateur Firefox, la valeur de retour est : Netscape

  • appVersion : le numéro de version principale du logiciel de navigation.

  • systemLanguage : langue du système

  • userLanguage : langue de l'utilisateur

  • platform : plateforme

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script type="text/javascript">
            //实例:测试不同浏览器
            var str = "<h2>浏览器的相关信息</h2>";
            str += "软件名称:"+navigator.appName;
            str += "<br>核心版本:"+navigator.appVersion;
            str += "<br>系统语言:"+navigator.systemLanguage;
            str += "<br>用户语言:"+navigator.userLanguage;
            str += "<br>用户平台:"+navigator.platform;
            document.write(str+"<hr>");
            var width;
            var height;
            if(navigator.appName=="Netscape")
            {
                width = window.innerWidth;
                height = window.innerHeight;
            }else
            {
                width = document.documentElement.clientWidth;
                height = document.documentElement.clientHeight;
            }
            document.write("浏览器内宽:"+width+",浏览器内高:"+height);
        </script>
    </head>
    <body >
    </body>
</html>


Formation continue
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script type="text/javascript"> //实例:测试不同浏览器 var str = "<h2>浏览器的相关信息</h2>"; str += "软件名称:"+navigator.appName; str += "<br>核心版本:"+navigator.appVersion; str += "<br>系统语言:"+navigator.systemLanguage; str += "<br>用户语言:"+navigator.userLanguage; str += "<br>用户平台:"+navigator.platform; document.write(str+"<hr>"); var width; var height; if(navigator.appName=="Netscape") { width = window.innerWidth; height = window.innerHeight; }else { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } document.write("浏览器内宽:"+width+",浏览器内高:"+height); </script> </head> <body > </body> </html>
soumettreRéinitialiser le code
  • Recommandations de cours
  • Téléchargement du didacticiel
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!