Detection Browser, note the browser to determine the order, mainly based on useragent to make judgments.detecting browsersvar client = function () {var engine = {ie:0,gecko:0,webkit:0,khtml:0,opera:0,Ver:null};var browser = {Browserie:0,firefox:0,safari:0,konq:0,opera:0,chrome:0,Ver:null};var ua = navigator.useragent;Browser detection is sequentialif (Window.opera) {//opera masquerading, so priority detectionEngine.ver = Browser.ver = Window.opera.ver
browser type, and record the number of visitors to optimize the design of your website to improve the customer experience.Copy codeThe Code is as follows:Or:KindEditor:KE = {};KE. browser = (function (){Var ua = navigator. userAgent. toLowerCase ();Return {VERSION: ua. match (/(msie | firefox | webkit | opera) [\/: \ s] (\ d + )/)? RegExp. $2: "0 ",IE :( ua. ind
There are many methods for determining the browser and version on the Internet. Here, the younger brother sums up one or two to save everyone's time.1. jquery method: Regular Expressions can be used to determine common browsers and their versions.Copy codeThe Code is as follows:Var ua = navigator. userAgent;Ua = ua. toLowerCase ();Var match =/(webkit) [\/] ([\ w.
Http-equiv, as the name implies, is equivalent to the HTTP file header function, it can send back some useful information to the browser to help correct and accurate display of the content of the Web page, and the corresponding property value of content,content content is actually the variable value of each parameter.
X-ua-compatible (ie Proprietary)The fierce competition in market share of Web browser has brought about the trouble of compatibility
This article mainly introduces the example of php useragent version detection. For more information, see
The code is as follows:
Define ('ie', 1 );
Define ('Firefox ', 2 );
Define ('chromi', 3 );
Define ('Opera ', 4 );
Class UserAgentDetect
{
Static $ version = array ();
Static $ userAgent = '';
Static function getUserAgent (){$ Header = getallheaders ();Self: $ userAgent = $ header ['user-agent'];}Function findUserAgentByKey ($ ua, $ key){$ Len =
// Original author: epsilon7 // SonyMusic (sonymusic@163.net) classBrowserDetector #123; var #36; UA; // #36; HTTP_USER_AGENT content var #36; BROWSERUnknown; // browser type var #36; PLATFORMUnknown; // original author: epsilon7
// SonyMusic (sonymusic@163.net)
Class BrowserDetector {
Var $ UA = ""; // content of $ HTTP_USER_AGENT
Var $ BROWSER = "Unknown"; // BROWSER type
Var $ PLATFORM = "Unknown";
meta
http-equiv
=
"X-UA-Compatible"
content
=
"IE=edge,chrome=1"
/>Introduction:
This is a dedicated identifier of IE8. It is used to specify the IE8 browser to simulate the rendering mode of a specific version of IE browser (such as IE6), to solve some compatibility problems, for example, the method for simulating IE7 is as follows:
meta
http-equiv
=
"X-UA-Compatible"
content
=
"IE=EmulateIE7"
/>
But I
); JQuery.browser.majorVersion= parseint (' + jQuery.browser.fullVersion, 10); if(IsNaN (jQuery.browser.majorVersion)) {jQuery.browser.fullVersion= ' +parsefloat (navigator.appversion); JQuery.browser.majorVersion= parseint (navigator.appversion, 10); } jQuery.browser.version=jQuery.browser.majorVersion; }) (JQuery); In addition, there is another plugin on the internet, the principle is the same. I have not tested, first recorded here:Jquery.extend ({browser:function() {
This article mainly introduces the PHP detection useragent version of the example, the need for friends can refer to the following nbsp; nbsp; Code as follows: lt;?php define (' IE ', 1); Define (' FIREFOX ', 2); Define (' CHROME ', 3); Define (' OPERA ', 4); Class Useragentdetect {nbsp; nbsp; static $version = Array () nbsp; nbsp; nbsp; static $userAgent = '; nbsp; nbsp ; nbsp; static function getuseragent () nbsp; nbsp;: nbsp; nbsp; nbsp; nbsp; $header = Getallheaders (); nbsp; nbsp; nbsp; n
Browser
A browser Check class
Original Author:
epsilon7
//
Sonymusic(sonymusic@163.net)
Class Browserdetector {
var $UA = ""; The contents of the $HTTP _user_agent
var $BROWSER = "Unknown"; Browser type
var $PLATFORM = "Unknown"; Operating system
var $VERSION = ""; Browser version number
var $MAJORVER = ""; Browser Major Version number
var $MINORVER = ""; Browser pair version number
/* Constructor started/*
function Browserdetector () {
$this->
Encyclopedia, Csdn Community) and x-ua-compatible Meta tags and head:
26% of Web sites specify the use of weird patterns if amazon.com,tworld.co.kr and unibanco.com.br.41% of websites Use the transitional document type, the quasi standard mode (Mozilla English material).14% of Web sites have added x-ua-compatible Meta tags or HTTP response headers to render using IE7 Standard mode.
The above data is unde
browser, it will provide an identity to the Web site of the browser type, operating system and version, CPU type, and so on that the user is using. But because many users are currently using Microsoft's Windows system, there are far more ads for Windows systems than other systems. So we can simply disguise ourselves as a user of other computer systems, so that the ad that the site pushes will naturally diminish.
Also first into Google's browser application mall, search and install a "user-agen
2.0.50727;. NET CLR 3.0.30729;. NET CLR 3.5.30729; rv:11.0) Like Gecko "* Internet Explorer 10---" mozilla/5.0 (CompatiblE MSIE x.0; Windows NT 10.0; WOW64; trident/8.0;. net4.0c;.
net4.0e. NET CLR 2.0.50727;. NET CLR 3.0.30729;. NET CLR 3.5.30729) "*/function () {window.iclient = {}; Render engine information var engine = {//render engine ie:0, gecko:0, webkit:0, khtml:0, opera:0,//specific version number VE
R:null};
var browser = {//browser ie:0, edge:0, firefox:0, safari:0, konq:0
In general, we can direct the user to download files by directly having the URL point to a file located under document root.
However, in doing so, there is no way to do some statistics, permission checks, etc. work. So, a lot of times, we use to make PHP to do forwarding, to provide users with file downloads.
$file = "/tmp/dummy.tar.gz";
Header ("Content-type:application/octet-stream");
Header (' Content-disposition:attachment filename= '. basename ($file). '"');
Header ("Content-length
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.