PHP Determines whether the user's browser installs the Alexa toolbar Program _php Tutorial

Source: Internet
Author: User
This article to everyone about PHP to determine whether the user browser installed Alexa toolbar program, the principle is very simple we just get and user user-agent recognition characters, and then judge to know that the user is not installed Alexa tool bar Oh.

As we all know, Alexa toolbar is a common web site third-party statistical tools, usually we will customize the Alexa toolbar for users to install, through the user's click on the content of the toolbar to improve the site in the Alexa rankings. such as the Alexa toolbar of Hebei News Network.

If we need to force users to install in some of the necessary PHP applications, this involves the determination of whether the Alexa toolbar is installed or not. When the browser accesses the Web page, PHP can obtain the user's user-agent recognition characters. Using the Alexa toolbar browser when requesting a Web page, the user-agent recognition character will be more than the Alexa tag. Use this feature to determine whether the user's browser installs the Alexa toolbar. Use PHP's $_server[' http_user_agent ' to get the UA string information for the browser. The following PHP determines whether the user's browser installs the Alexa toolbar code:

The code is as follows Copy Code
if (!preg_match ("#Toolbar #i", $_server[' Http_user_agent ')) { showmessage (L (' alexa_failure '), ' https:/ /www.bkjia.c0m ', 8000); }
( As Firefox and IE browser user-agent recognition characters are different, in Firefox for the Alexa Toolbar,ie in my Toolbar. So when we judge, we just have to judge if the toolbar is included in the recognition character.)

Note: IE9 's Alexa Toolbar Information acquisition method

Microsoft's official development blog says that IE9 uses a shorter user-agent recognition character by default, no longer attached. NET and any other information generated by the software or machine into the UA string. So if we want to get the IE9 user installed the Alexa toolbar, you have to let the user click on " Compatibility View " (as shown)

http://www.bkjia.com/PHPjc/632752.html www.bkjia.com true http://www.bkjia.com/PHPjc/632752.html techarticle This article to everyone about PHP to determine whether the user browser installed Alexa toolbar program, the principle is very simple we just get and user user-agent recognition characters, and then judge can know the user ...

  • Related Article

    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.