久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='po5Zy'><style id='po5Zy'><dir id='po5Zy'><q id='po5Zy'></q></dir></style></legend>

<small id='po5Zy'></small><noframes id='po5Zy'>

    1. <i id='po5Zy'><tr id='po5Zy'><dt id='po5Zy'><q id='po5Zy'><span id='po5Zy'><b id='po5Zy'><form id='po5Zy'><ins id='po5Zy'></ins><ul id='po5Zy'></ul><sub id='po5Zy'></sub></form><legend id='po5Zy'></legend><bdo id='po5Zy'><pre id='po5Zy'><center id='po5Zy'></center></pre></bdo></b><th id='po5Zy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='po5Zy'><tfoot id='po5Zy'></tfoot><dl id='po5Zy'><fieldset id='po5Zy'></fieldset></dl></div>
        <bdo id='po5Zy'></bdo><ul id='po5Zy'></ul>
    2. <tfoot id='po5Zy'></tfoot>

        瀏覽器/手機檢測有哪些可用的解決方案

        What are available solutions of a browser / mobile phone detection(瀏覽器/手機檢測有哪些可用的解決方案)

        <small id='dfCpB'></small><noframes id='dfCpB'>

            <tbody id='dfCpB'></tbody>

              • <legend id='dfCpB'><style id='dfCpB'><dir id='dfCpB'><q id='dfCpB'></q></dir></style></legend>
                  <bdo id='dfCpB'></bdo><ul id='dfCpB'></ul>

                  <i id='dfCpB'><tr id='dfCpB'><dt id='dfCpB'><q id='dfCpB'><span id='dfCpB'><b id='dfCpB'><form id='dfCpB'><ins id='dfCpB'></ins><ul id='dfCpB'></ul><sub id='dfCpB'></sub></form><legend id='dfCpB'></legend><bdo id='dfCpB'><pre id='dfCpB'><center id='dfCpB'></center></pre></bdo></b><th id='dfCpB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dfCpB'><tfoot id='dfCpB'></tfoot><dl id='dfCpB'><fieldset id='dfCpB'></fieldset></dl></div>
                  <tfoot id='dfCpB'></tfoot>
                • 本文介紹了瀏覽器/手機檢測有哪些可用的解決方案的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在為各種移動平臺創建一個 phonegap 應用程序,我想知道當前瀏覽器/手機檢測的最佳解決方案是什么?

                  我應該使用服務器或客戶端檢測,還是可以通過媒體類型屏幕寬度使用 css 解決方案?

                  解決方案

                  變更:

                  • 06.03.2013 - 在 WURFL 章節中添加一些評論

                  介紹:

                  可用的解決方案很少,但我只會列出開源的解決方案,至少主要用于 jQuery/jQuery Mobile 的解決方案.還請注意,這個話題有可能引發戰爭.一方面,我們支持使用他們社區維護的數據庫進行服務器端檢測,另一方面,我們擁有使用瀏覽器嗅探的客戶端支持者.

                  服務器端:

                  WURFL -

                  <塊引用>

                  創建于 2002 年的 WURFL(無線通用資源文件)是一個解決設備碎片化的流行開源框架移動 Web 開發人員和移動中的其他利益相關者的問題生態系統.WURFL 一直是并且仍然是事實上的標準移動開發人員采用的設備描述存儲庫.WURFL 是開源 (AGPL v3) 和 ScientiaMobile 的商標.

                  好:

                  非常詳細的檢測,你可能會得到更多的數據,然后才是真正需要的.

                  良好的平臺支持,API 可用于 Java、PHP 和 .Net.

                  糟糕:

                  不總是最新的,嚴重依賴社區

                  如果是 iPhone,則無法知道 iOS 版本,因此通過媒體類型查詢來檢測像素比率.

                  僅對非商業用途收費,舊版本仍可免費用于商業用途,但只能使用更新至 WURFL EULA 更改的數據庫.

                  • 可在此處找到:http://wurfl.sourceforge.net/apis.php

                  PHP 示例:

                  getWURFLInfo();if (isset($_GET['ua']) &&trim($_GET['ua'])) {$ua = $_GET['ua'];$requestingDevice = $wurflManager->getDeviceForUserAgent($_GET['ua']);} 別的 {$ua = $_SERVER['HTTP_USER_AGENT'];//此行通過查看其 HTTP 請求 ($_SERVER) 來檢測訪問設備$requestingDevice = $wurflManager->getDeviceForHttpRequest($_SERVER);}?><頭><title>WURFL PHP API 示例</title><身體><h3>WURFL XML 信息</h3><ul><li><h4>版本:<?php echo $wurflInfo->version;?></h4></li><div id="內容">用戶代理:<b><?php echo htmlspecialchars($ua);?></b><ul><li>ID: <?php echo $requestingDevice->id;?><li>品牌名稱:<?php echo $requestingDevice->getCapability('brand_name');?><li>模型名稱:<?php echo $requestingDevice->getCapability('model_name');?><li>營銷名稱:<?php echo $requestingDevice->getCapability('marketing_name');?><li>首選標記:<?php echo $requestingDevice->getCapability('preferred_markup');?><li>分辨率寬度:<?php echo $requestingDevice->getCapability('resolution_width');?><li>分辨率高度:<?php echo $requestingDevice->getCapability('resolution_height');?><p><b>通過提供用戶代理來查詢 WURFL:</b></p><form method="get" action="index.php"><div>用戶代理:<input type="text" name="ua" size="100" value="<?php echo isset($_GET['ua'])? htmlspecialchars($_GET['ua']): ''; ?>"/><input type="submit"/></div></表單>

                  如果要自定義此代碼,請更改 wurfl_config_standard.php 文件中的配置參數.

                  <小時>

                  Modernizr - 服務器 -

                  <塊引用>

                  Modernizr 是了解用戶瀏覽器的好方法能力.但是,您只能在瀏覽器上訪問其 API本身,這意味著您不能輕易地從了解服務器邏輯中的瀏覽器功能.現代化服務器庫是一種將 Modernizr 瀏覽器數據帶到您的服務器的方法腳本環境.

                  好:

                  像 WURFL 非常詳細的檢測,但我們需要考慮到它是為了不同的目的而構建的 WURFL.

                  糟糕:

                  僅在 PHP 上支持,但有時這已經足夠了.

                  示例:

                  <頭><meta charset="utf-8"><title>Modernizr 服務器示例</title><身體><?phpinclude('modernizr-server.php');打印'服務器知道:';foreach($modernizr as $feature=>$value) {打印 "<br/> $feature: ";打印_r($值);}?>

                  • 可以在這里找到:https://github.com/jamesgpearce/modernizr-server

                  客戶端:

                  現代化者 -

                  <塊引用>

                  利用酷炫的網絡新技術非常有趣,直到您必須支持落后的瀏覽器.Modernizr 使你編寫條件 JavaScript 和 CSS 來處理每種情況,瀏覽器是否支持某個功能.非常適合做輕松進行漸進增強.

                  好:

                  只有客戶端,服務器端組件不存在

                  速度快,但對于 12kb 的 javascript 框架來說仍然很大.由于其模塊化,它可以根據您的需要變得更小.

                  糟糕:

                  只能做這么多,比服務器端檢測更少的信息.

                  Modernizr 本身是一種了解用戶瀏覽器功能的好方法.但是,您只能在瀏覽器本身上訪問其 API,這意味著您無法輕松地從服務器邏輯中的瀏覽器功能中獲益.

                  • 可以在這里找到:http://modernizr.com/

                  示例:

                   <頭><meta charset="utf-8"><title>Modernizr 示例</title><script src="modernizr.min.js"></script><身體><腳本>如果(Modernizr.canvas){//支持的} 別的 {//沒有可用的原生畫布支持:(}

                  基于 JavaScript 的瀏覽器嗅探

                  <塊引用>

                  有爭議的是,這可能是(學術上)最糟糕的方式檢測移動設備,但它確實有其優點.

                  好:

                  簡單

                  糟糕:

                  從哪里開始

                  示例:

                  I am creating a phonegap application for various mobile platforms and I was wondering what is a current best solution of browser/mobile phone detection?

                  Should I go with a server or a client side detection or could I use css solution through a media types screen width?

                  解決方案

                  Changes:

                  • 06.03.2013 - Addad a few comments inside a WURFL chapter

                  Intro :

                  There are few available solutions but I will only name open-source ones, at least solutions mostly used with a jQuery/jQuery Mobile. Also be warned, this topic has the potential to start a war. On one side we have a proponents of server side detection with their community maintained databases and on the other side we have client side advocates with their browser sniffing.

                  Server side:

                  WURFL -

                  Created in 2002, WURFL (Wireless Universal Resource FiLe), is a popular open-source framework to solve the device-fragmentation problem for mobile Web developers and other stakeholders in the mobile ecosystem. WURFL has been and still is the de facto standard device-description repository adopted by mobile developers. WURFL is open source (AGPL v3) and a trademark of ScientiaMobile.

                  Good :

                  Very detailed detection, you would probably get more data then is really needed.

                  Good platform support, api's are available for Java, PHP and .Net.

                  Bad :

                  Not always up to date, heavy dependency on community

                  In case of iPhone there's no way of knowing an iOS version, so media type queries to detect pixel ratios.

                  Fee only for a non commercial usage, older version are still free for commercial usage but they can only use database updated up to WURFL EULA changes.

                  • It can be found here: http://wurfl.sourceforge.net/apis.php

                  PHP example :

                  <?php
                      // Include the configuration file
                      include_once './inc/wurfl_config_standard.php';
                  
                      $wurflInfo = $wurflManager->getWURFLInfo();
                  
                      if (isset($_GET['ua']) && trim($_GET['ua'])) {
                          $ua = $_GET['ua'];
                          $requestingDevice = $wurflManager->getDeviceForUserAgent($_GET['ua']);
                      } else {
                          $ua = $_SERVER['HTTP_USER_AGENT'];
                          // This line detects the visiting device by looking at its HTTP Request ($_SERVER)
                          $requestingDevice = $wurflManager->getDeviceForHttpRequest($_SERVER);
                      }
                  ?>  
                  <html>
                  <head>
                      <title>WURFL PHP API Example</title>
                  </head>
                  <body>
                      <h3>WURFL XML INFO</h3>
                      <ul>
                          <li><h4>VERSION: <?php echo $wurflInfo->version; ?> </h4></li>
                      </ul>
                      <div id="content">
                          User Agent: <b> <?php echo htmlspecialchars($ua); ?> </b>
                          <ul>
                              <li>ID: <?php echo $requestingDevice->id; ?> </li>
                              <li>Brand Name: <?php echo $requestingDevice->getCapability('brand_name'); ?> </li>
                              <li>Model Name: <?php echo $requestingDevice->getCapability('model_name'); ?> </li>
                              <li>Marketing Name: <?php echo $requestingDevice->getCapability('marketing_name'); ?> </li>
                              <li>Preferred Markup: <?php echo $requestingDevice->getCapability('preferred_markup'); ?> </li>
                              <li>Resolution Width: <?php echo $requestingDevice->getCapability('resolution_width'); ?> </li>
                              <li>Resolution Height: <?php echo $requestingDevice->getCapability('resolution_height'); ?> </li>
                          </ul>
                          <p><b>Query WURFL by providing the user agent:</b></p>
                          <form method="get" action="index.php">
                              <div>User Agent: <input type="text" name="ua" size="100" value="<?php echo isset($_GET['ua'])? htmlspecialchars($_GET['ua']): ''; ?>" />
                              <input type="submit" /></div>
                          </form>
                      </div>
                  </body>
                  </html>
                  

                  If you want to customize this code, change configuration parameters inside a wurfl_config_standard.php file.


                  Modernizr - Server -

                  Modernizr is a great way to find out about your user's browser capabilities. However, you can only access its API on the browser itself, which means you can't easily benefit from knowing about browser capabilities in your server logic. The modernizr-server library is a way to bring Modernizr browser data to your server scripting environment.

                  Good :

                  Like WURFL very detailed detection, but we need to take into consideration that it is build with a different purpose the WURFL.

                  Bad :

                  Only supported on PHP, but sometimes this will be enough.

                  Example :

                  <!DOCTYPE html>
                  <html>
                  <head>
                    <meta charset="utf-8">
                    <title>Modernizr Server Example</title>
                  </head>
                  <body>
                  <?php
                      include('modernizr-server.php');
                  
                      print 'The server knows:';
                      foreach($modernizr as $feature=>$value) {
                          print "<br/> $feature: "; print_r($value);
                      }
                  ?>
                  </body>
                  </html>
                  

                  • It can be found here: https://github.com/jamesgpearce/modernizr-server

                  Client side:

                  Modernizer -

                  aking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It’s perfect for doing progressive enhancement easily.

                  Good :

                  Only client side, server side component don't exist

                  Fast but still large for a javascript framework with its 12kb. Because of its modularity it can become smaller, depending on your needs.

                  Bad :

                  Can do only so much, less info then server side detection.

                  Modernizr itself is a great way to find out about your user’s browser capabilities. However, you can only access its API on the browser itself, which means you can’t easily benefit from knowing about browser capabilities in your server logic.

                  • It can be found here: http://modernizr.com/

                  Example :

                      <!DOCTYPE html>
                      <html>
                      <head>
                        <meta charset="utf-8">
                        <title>Modernizr Example</title>
                        <script src="modernizr.min.js"></script>
                      </head>
                      <body>
                        <script>
                          if (Modernizr.canvas) {
                            // supported
                          } else {
                            // no native canvas support available :(
                          }  
                        </script>
                      </body>
                      </html>
                  

                  JavaScript based browser sniffing

                  It is arguable that this may be (academically) the worst possible way to detect mobile but it does have its virtues.

                  Good :

                  Simple

                  Bad :

                  Where to begin

                  Example :

                  <script type="text/javascript">     
                      var agent = navigator.userAgent;      
                      var isWebkit = (agent.indexOf("AppleWebKit") > 0);      
                      var isIPad = (agent.indexOf("iPad") > 0);      
                      var isIOS = (agent.indexOf("iPhone") > 0 || agent.indexOf("iPod") > 0);     
                      var isAndroid = (agent.indexOf("Android")  > 0);     
                      var isNewBlackBerry = (agent.indexOf("AppleWebKit") > 0 && agent.indexOf("BlackBerry") > 0);     
                      var isWebOS = (agent.indexOf("webOS") > 0);      
                      var isWindowsMobile = (agent.indexOf("IEMobile") > 0);     
                      var isSmallScreen = (screen.width < 767 || (isAndroid && screen.width < 1000));     
                      var isUnknownMobile = (isWebkit && isSmallScreen);     
                      var isMobile = (isIOS || isAndroid || isNewBlackBerry || isWebOS || isWindowsMobile || isUnknownMobile);     
                      var isTablet = (isIPad || (isMobile && !isSmallScreen));     
                  
                      if ( isMobile && isSmallScreen && document.cookie.indexOf( "mobileFullSiteClicked=") < 0 ) mobileRedirect(); 
                  </script>
                  

                  這篇關于瀏覽器/手機檢測有哪些可用的解決方案的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                  1. <tfoot id='OUS0C'></tfoot>

                    <small id='OUS0C'></small><noframes id='OUS0C'>

                  2. <legend id='OUS0C'><style id='OUS0C'><dir id='OUS0C'><q id='OUS0C'></q></dir></style></legend>

                    • <bdo id='OUS0C'></bdo><ul id='OUS0C'></ul>

                        <tbody id='OUS0C'></tbody>
                      • <i id='OUS0C'><tr id='OUS0C'><dt id='OUS0C'><q id='OUS0C'><span id='OUS0C'><b id='OUS0C'><form id='OUS0C'><ins id='OUS0C'></ins><ul id='OUS0C'></ul><sub id='OUS0C'></sub></form><legend id='OUS0C'></legend><bdo id='OUS0C'><pre id='OUS0C'><center id='OUS0C'></center></pre></bdo></b><th id='OUS0C'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='OUS0C'><tfoot id='OUS0C'></tfoot><dl id='OUS0C'><fieldset id='OUS0C'></fieldset></dl></div>

                          主站蜘蛛池模板: 日韩高清国产一区在线 | 成人av在线播放 | 精品视频一区二区 | 新91视频网 | 国内精品久久精品 | 91国在线| 久久久女 | 人人九九精 | 神马影院一区二区三区 | 亚洲国产成人精品女人久久久 | 高清国产午夜精品久久久久久 | 亚洲字幕在线观看 | 亚洲欧美另类在线 | 国产一区免费 | 中文字幕在线观看成人 | 欧美一级片a | 九九热这里只有精品在线观看 | 国产乱码久久久久久 | 一区精品国产欧美在线 | 日批日韩在线观看 | 久久久久久av | 亚洲一区在线播放 | 在线观看视频h | 久久精品高清视频 | 成人一区二区三区在线观看 | 国产免费一区二区三区 | 午夜av电影 | 成人动漫一区二区 | 亚洲 欧美 在线 一区 | 久久综合九九 | 九九热九九 | 九九久久久 | 久久精品色欧美aⅴ一区二区 | 国外成人在线视频 | 91久久久久久久久久久 | 久久午夜精品 | 亚洲国产高清高潮精品美女 | 成人高潮片免费视频欧美 | 久久网站黄 | av在线天堂网 | 免费污视频 |