使用移动应用元标记隐藏移动浏览器搜索栏?

问题描述 投票:0回答:0

好吧,我知道像 scrollTo 这样的东西不再起作用了。

但我发现了一个使用元标记让任何浏览器相信您的网站是移动应用程序的想法,因此隐藏了页面加载时的搜索栏。

我对此的看法是将标签添加到 functions.php。

我试过这段代码:

// Add custom meta tags to the head section of the website
function add_custom_meta_tags_to_head() {
?>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="path/to/icon.png">
<?php
}
add_action('wp_head', 'add_custom_meta_tags_to_head');
// Add custom meta tags to the head section of the website

但不知何故它不起作用。

现在的问题是我的代码错了还是这个方法是另一个死胡同?

谨致问候 克里斯

php header meta-tags mobile-application mobile-browser
© www.soinside.com 2019 - 2024. All rights reserved.