browsers, and the other is to judge by analyzing the useragent attributes of the browser. In many cases, after determining the browser type, you must determine the browser version to handle compatibility issues. However, you can only determine the browser version by analyzing the browser's useragent.
Let's analyze the features of various browsers and Their useragent
first determine the browser type and version accurately.
JavaScript is the main language for front-end development. We can compile JavaScript programs to determine the browser type and version. There are two methods to determine the browser type in JavaScript: one is to distinguish based on the unique attributes of various browsers, and the other is to judge by analyzing the userAgent attributes of the browser. In many cases, after determining the br
A few days ago, the browser family had just born a little prince, the Chrome browser that Google launched. Because of the blue-blooded chrome, no one dared to underestimate him, even though he was still a little boy. Later, we often say that the "four great talent" of the browser has to be renamed as "Five Golden flowers."In the front-end development of the Web site, browser compatibility problem has let us rush, the birth of Chrome did not know to give us a lot of trouble. Browser compatibility
is based on a variety of browser-specific properties to distinguish, the other is by analyzing the browser's useragent properties to judge. In many cases, after the value is judged by the browser type, it is also necessary to judge the browser version to handle the compatibility issue, and to judge the browser version is generally only through the analysis of the browser useragent to know.
Let's first anal
RecentlySitu zhengmei-Determination of the world's shortest IEThe article shows that only 6 bytes of IE and non-ie methods are judged. ItsCodeAs follows:
In fact, there are many judgment methods, mostly based on the characteristics of the browser.
For example, the method for database prototype is :!! (Window. attachevent navigator. useragent. indexof ('Opera ') ===- 1 ). It is determined by IE's support for window. attachevent to add listeni
Solve the DisallowedKeyCharacters error message of the CI framework. When using the CI framework, you may encounter such a problem. when you open a webpage, only the error message "DisallowedKeyCharacters" is displayed. Some people say that the url contains invalid characters. However, when you determine that the url is a pure English CI framework, you may encounter such a problem. when you open the webpage, only the Disallowed Key Characters error me
IE
To modify the useragent of IE, you must edit the registry.
"HKEY_CURRENT_USER" software "Microsoft" Windows "CurrentVersion" Internet Settings "5.0" User Agent "post platform"
"HKEY_LOCAL_MACHINE" software "Microsoft" Windows "CurrentVersion" Internet Settings "User Agent" post platform"
"HKEY_LOCAL_MACHINE" software "Microsoft" Windows "CurrentVersion" Internet Settings "5.0" User Agent "post platform"
If you want to change
/*** Obtains the operating system information of the client. Currently, only Windows 7, WINXP, win2003, Win2000, Mac, WINNT, Linux, mac68k, and Win9x are matched.* @ Param useragent request. getheader ("User-Agent") Return Value* @ Return*/
Public static string getclientos (string useragent){String cos = "unknow OS ";Pattern P = pattern. Compile (". * (Windows NT 6 \. 1 ).*");Matcher M = P. matcher (
Usage:
$. Browser. ['browser keyword ']
Copy codeThe Code is as follows: $ (function (){
If ($. browser. msie ){
Alert ("this is msie ");
}
Else if ($. browser. safari)
{
Alert ("this is safari! ");
}
Else if ($. browser. mozilla)
{
Alert ("this is mozilla! ");
}
Else if ($. browser. opera ){
Alert ("this is opera ");
}
Else {
Alert ("I don't konw! ");
}
Let's take a look at the jQuery source code:Copy codeThe Code is as follows: var userAgent = navig
autosavetime function, and will write the value of the sec-1 into the autosavetimebox} Else {Var title = document. getElementById ('title ');If (title. value! = ''){Autosave_post ();} Else {Document. getElementById ('autosavetimebox'). innerHTML = 'do not save ';}}
This part is when the sec> 0 condition is not true, huh, that is, when the sec
The php code is as follows:
The code is as follows:
Var userAgent = navigator.
); clears the timer
Document. getElementById ('autosavetimebox'). innerHTML = sec + "seconds"; get the autosavetimebox object on the page, and write a countdown to it
The code is as follows:
If (sec> 0 ){Autosavetimer = setTimeout ("autosavetime (" + sec + "-1)", 1000 );// Here is if when the sec> 0, the first second executes the autosavetime function, and will write the value of the sec-1 into the autosavetimebox} Else {Var title = document. getElementById ('title ');If (title. value! = ''){Aut
various browsers, and the other is judged by analyzing the browser's useragent properties. In many cases, after the value of the browser type is determined, you also need to determine the browser version to handle compatibility issues, and the browser version can only be determined by analyzing the browser useragent to know.Let us first analyze the features of various browsers and their useragent.IEOnly IE
version of the browser. JavaScript generally has two ways of judging browser types, one is based on the unique attributes of various browsers, and the other is judged by analyzing the browser's useragent properties. In many cases, after the value of the browser type is determined, you also need to determine the browser version to handle compatibility issues, and the browser version can only be determined by analyzing the browser
various browsers, and the other is judged by analyzing the browser's useragent properties. In many cases, after the value of the browser type is determined, you also need to determine the browser version to handle compatibility issues, and the browser version can only be determined by analyzing the browser useragent to know.Let us first analyze the features of various browsers and their useragent.IEOnly IE
The C language is written in a simple HTTP request, and analysis of its response, the principle is very simple, mainly to analyze the HTTP response, the trouble is to extract the game information
Copy Code code as follows:
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Header files for #include #include
#define UserAgent "wget/1.10.2"#defin
So below share a PHP write to get each search Spider crawl record code
Support Search engine as follows
Can record the Baidu,google,bing,yahoo,soso,sogou,yodao crawl website record!
The PHP code is as follows
Copy Code code as follows:
function Get_naps_bot ()
{
$useragent = Strtolower ($_server[' http_user_agent '));
if (Strpos ($useragent, ' Googlebot ')!== false) {
Return ' Google ';
}
Records of Baidu,google,bing,yahoo,soso,sogou,yodao crawl sites can be recorded
The code is as follows:
01
02
Http://www.tongqiong.com
03
function Get_naps_bot ()
04
{
05
$useragent = Strtolower ($_server[' http_user_agent '));
06
07
if (Strpos ($
In other forums, a lot of the installation of Perl modules, in fact, sometimes very easy to install failure.
Especially on Windows, such as tools such as cpan,ppm can be used. At the command line
Enter CPAN, eject cpan>, and then enter install module name, such as I want to install Lwp::useragent::P roxyany
Input install Lwp::useragent::P Roxyany, but often there are mistakes, this way is very troublesome.
If you do not have a deep understanding of javascript, it is easy to write incompatible code (like me). At this time, you have to judge the browser. For example, event listening, mouse and keyboard events, and Range events are different. The following lists several common browser detection methods to attract viewers!
Check the code of the browser and its version
The Code is as follows:
GetBrowser: function (){Var browser = {Msie: false, firefox: false, opera: false, safari: false,Chrome: false
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.