【问题标题】:webcal:// protocol - creating ical reminders on Chrome iOS - hide subscribed URL from prompt?webcal:// 协议 - 在 Chrome iOS 上创建 ical 提醒 - 从提示中隐藏订阅的 URL?
【发布时间】:2021-03-10 05:00:32
【问题描述】:

我在网站上有一个按钮,可以在点击时添加日历事件。我在大多数浏览器上使用ics.js,但在 iOS 上的 Safari 上使用了不同的解决方案,而在 iOS 上使用 Chrome 浏览器时,我必须实现 webcal:// 解决方案。

点击后打开的网址是webcal://mysite.com?calreminder=[title]&time=[time]

然后我们在服务器端生成这个输出:

function reminder_output()
{
    if (isset($_GET['calreminder'])) {
        $title = $_GET['calreminder'];
        $time = $_GET['time'];

        $now = new DateTime();
        $start = new DateTime('tomorrow ' . $time);
        // event duration is 10 minutes
        $duration = new DateInterval('PT10M');
        $end = $start->add($duration);

        header('Content-Type: text/calendar; charset=utf-8');
        header('Content-Disposition: attachment; filename="My-Site-Reminder.ics"');
        $calData = array(
            'BEGIN:VCALENDAR',
            'PRODID:-//My Site//Reminder//EN',
            'VERSION:2.0',
            'BEGIN:VEVENT',
            'RRULE:FREQ=DAILY;INTERVAL=1',
            'DTSTAMP:' . $now->format('Ymd') . 'T' . $now->format('His'),
            'UID:4088E990AD89VW3DBB4849094',
            'DTSTART:' . $start->format('Ymd') . 'T' . $start->format('His'),
            'DTEND:' . $end->format('Ymd') . 'T' . $end->format('His'),
            'SUMMARY:' . $title,
            'DESCRIPTION:' . $title,
            'X-ALT-DESC;FMTTYPE=text/html:' . $title,
            'END:VEVENT',
            'END:VCALENDAR'
        );
        $calData = implode("\r\n", $calData);
        echo $calData;
        exit;
    }
}

这会打开这个提示:

一切正常,但理想情况下,我想从显示中隐藏 URL,而是显示事件的名称:“您想订阅 [Event Name] 吗?”

我知道一定可以做到,因为他们在 https://www.addevent.com/add-to-calendar-button 上做到了:

但是,我不知道如何以这种方式显示它而不是显示 URL。有人知道吗?

【问题讨论】:

    标签: icalendar webcal chrome-ios


    【解决方案1】:

    出现在提示中的日历名称,可以通过包含...来设置

    X-WR-CALNAME:Your Custom Name

    ...在 ics 输出的正文中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-06
      • 2020-12-14
      • 2020-06-15
      • 2023-01-14
      相关资源
      最近更新 更多