V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cuthead
V2EX  ›  前端开发

Safari 是如何显示 weibo.com 里面的 Webpage Icon 和 Push Notifications 的

  •  
  •   cuthead · 2015-02-26 03:27:23 +08:00 · 2049 次点击
    这是一个创建于 3369 天前的主题,其中的信息可能已经有所发展或是发生改变。

    正常情况下
    Webpage Icon要使用
    <link rel="apple-touch-icon" href="/custom_icon.png">
    Push Notifications要使用
    window.safari.pushNotification.requestPermission
    weibo.com都没使用,但Safari下这两项都工作,是什么原因?Safari内置微博的这个功能吗?

    4 条回复    2015-02-26 12:20:49 +08:00
    yyfearth
        1
    yyfearth  
       2015-02-26 04:17:44 +08:00
    我觉得 Push Notifications 应该是系统支持 不是通过Safari
    OSX 你可以在 System Settings > Internet Accounts 里面登陆weibo
    iOS 也有这样支持
    然后系统就会接收通知了 不开Safari也可以用

    我不用weibo但是我用linkedIn 就是这样的
    cuthead
        2
    cuthead  
    OP
       2015-02-26 04:51:16 +08:00
    @yyfearth 我说的是Safari Push Notifications,在Safari - Preferences 下面有Notifications,是网站直接发Notifications,由Safari管理。这里有说明 https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW1
    另外我发现block http://js2.t.sinajs.cn/t6/webim_prime/js/common/all.js?version=70309a0171c708d7 就能禁止显示这个,但我不懂Javascript,无法找到是哪段Javascript控制了弹出这个窗口

    这就是我说的Safari Push Notifications
    yyfearth
        3
    yyfearth  
       2015-02-26 05:28:16 +08:00   ❤️ 1
    cuthead
        4
    cuthead  
    OP
       2015-02-26 12:20:49 +08:00
    @yyfearth 和这个类似,我在safari Inspect Element里搜了一下看起来像webkitNotifications,应该是Notification的一种
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1298 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:52 · PVG 07:52 · LAX 16:52 · JFK 19:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.