Html 你如何添加一个链接,将一个事件从 safari 添加到你的 iPhone 日历?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/168440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:28:14  来源:igfitidea点击:

How do you add a link that will add an event to your iPhone calendar from safari?

iphonehtmlmobile-safari

提问by drye

This seems like it should be simple but after a couple hours of googling I have not figured it out. I know I can add iCal links using ICS files, but this does not work on the iPhone.

这看起来应该很简单,但经过几个小时的谷歌搜索后,我还没有弄清楚。我知道我可以使用 ICS 文件添加 iCal 链接,但这在 iPhone 上不起作用。

BTW, when I say iPhone I would like it to work on the touch also. Anyone have any luck with this?

顺便说一句,当我说 iPhone 时,我希望它也能在触控上工作。有没有人有这方面的运气?

回答by goddogsrunning

You can get iPhone to download the .ics file (using Safari on a mobile web page) by using the webcal protocol:

您可以使用 webcal 协议让 iPhone 下载 .ics 文件(在移动网页上使用 Safari):

webcal://website.mobi/mymeeting.ics

webcal://website.mobi/mymeeting.ics

回答by jeffehobbs

As of iOS 5, if you create a simple http link to an .ics file, Mobile Safari will offer to open it up in Calendar.

从 iOS 5 开始,如果您创建一个指向 .ics 文件的简单 http 链接,Mobile Safari 将提供在日历中打开它。

回答by Stephen Darlington

According to the iPhone documentation there is no URL scheme for the Calendar application. (There are URL schemes for Mail, Phone, Map, YouTube and iTunes.)

根据 iPhone 文档,日历应用程序没有 URL 方案。(有用于邮件、电话、地图、YouTube 和 iTunes 的 URL 方案。)

Of course there could be something undocumented, but I'm not sure that using it would be a good idea even if you can find it.

当然,可能有一些未记录的东西,但我不确定使用它是否是一个好主意,即使你能找到它。

回答by Lee

Of course it is possible but only if your JavaScript application is installed on the device. Look at http://tetontech.wordpress.comto see how to make calls from JavaScript to Objective-C. You can then use this and the Calendar Store Programming Guide from the documentation in Xcode to do what you want.

当然这是可能的,但前提是您的 JavaScript 应用程序安装在设备上。查看http://tetontech.wordpress.com以了解如何从 JavaScript 调用 Objective-C。然后,您可以使用它和 Xcode 文档中的 Calendar Store Programming Guide 来执行您想要的操作。

回答by Genericrich

It is not possible. Apple does not want you to do this.

这不可能。Apple 不希望您这样做。

Now, what you could do is bookmark a javascript bookmarklet that checks the user-agent of the browser invoking it, and if the user is on Safari on their laptop or desktop Mac, then invoke the iCal using standard method (ICS file).

现在,您可以做的是为 JavaScript 书签添加书签,该书签检查调用它的浏览器的用户代理,如果用户在笔记本电脑或台式 Mac 上使用 Safari,则使用标准方法(ICS 文件)调用 iCal。

The user on iPhone could bookmark your page into a home screen bookmark with a useful (and perhaps custom) icon that said "Event" and title of "Meet Mary at 8:15". They could then, when they have synced their bookmarks, be reminded of the event and invoke it on their desktop browser.

iPhone 上的用户可以将您的页面添加到主屏幕书签中,并带有一个有用的(也许是自定义的)图标,上面写着“事件”和“在 8:15 与玛丽见面”的标题。然后,当他们同步了他们的书签时,他们可以被提醒该事件并在他们的桌面浏览器上调用它。

Significant barriers here to educating users how to use this system, but it would work if you could convince people to do it, I think.

在教育用户如何使用这个系统方面存在重大障碍,但我认为如果你能说服人们这样做,它就会奏效。