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 ...