“添加到主屏幕”适用于Chrome iOS

qlfbtfca  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(156)

添加到主屏幕工程刚刚好Safari的iOS和Chrome的Android。
在发布问题之前搜索时看到了this answer。我想知道有没有人知道这件事的最新进展?
如果这不是简单的添加另一个Meta标记,有人能告诉我,在强制或完全删除URL和导航栏在Chrome的方向?
当然,我更希望能够将Web应用程序保存到主屏幕上,但我愿意接受建议。
提前感谢!

06odsfpq

06odsfpq1#

你猜怎么着?你现在可以了!
下面是我用来根据浏览器给出给予不同指令的代码:

const is_iOS = (/iPad|iPhone|iPod/.test(navigator.platform)) ? true :
        (navigator.maxTouchPoints &&
            navigator.maxTouchPoints > 2 &&
            /MacIntel/.test(navigator.platform)) ? true : // this is an new iPad Pro
            false

    // from the web; best thing I could find; will probably fail sometimes, but
    // as of 11/22/21 it is true for Safari and false for Chrome/Firefox/Opera
    //
    const is_Safari = /Version.+Safari/.test(navigator.userAgent)

    const is_Chrome_on_iOS = (/CriOS/i.test(navigator.userAgent) && is_iOS)

    if (is_iOS) {  // display instructions on how to add to home screen for iOS users

        const iOS_install_info = (is_Safari) ?

点击屏幕底部带有向上箭头的方块(共享图标)。向上滑动,直到在列表底部附近看到“添加到主屏幕”。您需要先关闭此警告框。 [If如果您没有看到“添加到主屏幕”,请滚动到底部并点击编辑操作,然后点击“添加到主屏幕”操作旁边的添加。现在您可以按照描述选择它。] 苹果让你手动这样做是为了保护他们的App Store利润!

: is_Chrome_on_iOS ?

点击屏幕右上方带有向上箭头的方块(共享图标)。向上滑动,直到您看到从列表底部开始大约五个项目的“添加到主屏幕”。 你得先关掉这个警告框,明白了吗? 苹果让你手动这样做是为了保护他们的App Store利润!

: // other browsers...

Congratulations on being in the 0.5%! ...of iOS folks who use a browser other than Safari or Chrome. I think many of you will be able to find an 'Add to Home Screen' button if you poke around a bit. It's usually under the browser's Share menu, which often has an icon of a box with an arrow pointing up out of it. Good luck.

setTimeout(() => {
                alert(iOS_install_info)
        }, 500)
    }

有没有人知道其他浏览器现在是否也能做到这一点?

**编辑:我刚刚测试了Firefox,它也工作。再拍一次

有没有人知道我是否有可能在我的代码示例中放置多行字符串文字,而不会将我们带回到主要的帖子主体?

相关问题