Home > CMS Tutorial > WordPress > body text

How WordPress determines the browser

藏色散人
Release: 2020-12-18 15:27:39
forward
2576 people have browsed it

The following column WordPress Tutorial will introduce to you how WordPress determines the browser. I hope it will be helpful to friends in need!

How WordPress determines the browser

Most of the current theme templates do not support the obsolete IE, which affects the experience. You can use the variables provided by WordPress to determine the browser used by the visitor, and then remind the user to upgrade. browser.

For example, add in the appropriate position of the theme template:

<?php
global $is_IE;
if ($is_IE) {
echo &#39;您正在使用不安全的IE浏览器,请使用现代浏览器,浏览本站,以获得最佳体验!&#39;;
}
?>
Copy after login

When someone uses IE to access the web page, a prompt message will be displayed. When someone uses IE to access the WP backend, there will be a similar prompt.

If you want to target other browsers, you can refer to the following variables, and so on.

$is_iphone (boolean) iPhone Safari
$is_chrome (boolean) Google Chrome
$is_safari (boolean) Safari
$is_NS4 (boolean) Netscape 4
$is_opera (boolean) Opera
$is_macIE (boolean) Mac Internet Explorer
$is_winIE (boolean) Windows Internet Explorer
$is_gecko (boolean) FireFox
$is_lynx (boolean)
$is_IE (boolean) Internet Explorer
$is_edge (boolean) Microsoft Edge
Copy after login

Source code: https://codex.wordpress.org/Global_Variables

The above is the detailed content of How WordPress determines the browser. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template