PHP judges whether the user's browser has installed the alexa toolbar program _ PHP Tutorial

Source: Internet
Author: User
PHP checks whether your browser has installed the alexa toolbar. This article introduces PHP to determine whether the alexa tool is installed in the User's browser. The principle is very simple. we only need to get the User-Agent character recognition, then, you can determine whether the alexa tool is installed in your browser. This article introduces PHP to determine whether your browser has installed the alexa tool. The principle is very simple. we only need to obtain the User-Agent character recognition, then you can check whether the alexa Toolbar is installed.

As we all know, the alexa Toolbar is a commonly used third-party statistical tool for websites. we usually customize the alexa toolbar to allow users to install it. you can click the toolbar content to improve the ranking of the website in alexa. For example, the alexa toolbar of Hebei News Network.

If we need to force user installation in some necessary php applications, this involves the judgment on whether the alexa Toolbar is installed or not. When a browser accesses a webpage, php can obtain User-Agent characters. When a browser with the Alexa Toolbar is used to request a webpage, the User-Agent character will contain more alexa marks. With this feature, you can determine whether your browser has installed the ALEXA toolbar. Use PHP's $ _ SERVER ['http _ USER_AGENT '] to obtain the UA string information of the browser.The following is the code for PHP to determine whether the alexa tool is installed in your browser:

The code is as follows:
If (! Preg_match ("# Toolbar # I", $ _ SERVER ['http _ USER_AGENT ']) {showmessage (L ('Alexa _ failure'), 'https: // www. bKjia. c0m', 8000 );}
(Because the User-Agent characters in firefox and ie are different, Alexa Toolbar in firefox and My Toolbar in ie. Therefore, we only need to determine whether the recognition character contains a Toolbar)

Note: how to obtain the alexa toolbar information of IE9

According to the official Microsoft development blog, IE9 uses short User-Agent characters by default and does not append. NET or any other information generated by software or machines to UA strings. Therefore, if you want to obtain whether the IE9 user has installed the alexa toolbar, you must click"Compatibility View"(As shown in)

...

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.