简体   繁体   English

可以制作 HTML 链接以在日历中打开日期时间吗?

[英]Can an HTML link be made to open a datetime in a calendar?

I am making myself a little table of deadlines in HTML and I've come across a question I've never thought about before.我正在为自己制作一个 HTML 截止日期的小表格,我遇到了一个我以前从未想过的问题。

I know that HTML links can reference more than just HTTP(S) webpages.我知道 HTML 链接可以引用的不仅仅是 HTTP(S) 网页。 They can open several types of addresses and external applications, particularly on mobile devices.他们可以打开多种类型的地址和外部应用程序,尤其是在移动设备上。 For example, if I wanted to connect users to Lou Malnati's Pizza in Lake Forest, IL there are lots of ways I could do that using only <a> tags.例如,如果我想将用户连接到位于伊利诺伊州森林湖的 Lou Malnati's Pizza,我可以通过多种方式仅使用<a>标签来实现。

I can open a phone number in the default phone app我可以在默认电话应用中打开电话号码

<a href="tel:+18477351515">Call Us</a>

I can start an email draft in the default webmail browser我可以在默认的网络邮件浏览器中启动电子邮件草稿

<a href="mailto:webmaster@loumalnatis.com">Email</a>

I can go to a specific location in the default maps application我可以转到默认地图应用程序中的特定位置

<a href="geo:42.224948,-87.874244">Directions</a>

In iOS I can even open a restaurant's page in the Yelp app在 iOS 中,我什至可以在 Yelp 应用中打开餐厅页面

<a href="yelp:///biz/lou-malnatis-pizzeria-lake-forest">Yelp</a>

There are even more that I'm not mentioning, especially in Darwin systems (including OS X).还有更多我没有提到的,尤其是在 Darwin 系统(包括 OS X)中。 I was thinking about this as I was writing my table of deadlines, and I started to wonder if I could do the same thing with a datetime.我在写截止日期表时正在考虑这个问题,我开始想知道我是否可以用日期时间做同样的事情。 This leads me to my real question.这引出了我真正的问题。

Is there any URL scheme in Darwin that will open Calendar to specific datetime?达尔文中是否有任何 URL 方案可以将日历打开到特定的日期时间?

Comme ça (using Darwin's usual ISO 8601 ) Comme ça (使用达尔文通常的ISO 8601

<a href="date:1918-11-11T11:00:00+02:00">The Guns Fell Silent</a>

I know that OS X uses the same system of URL based inter-app communication that iOS does, so I figure there's got to be a way.我知道 OS X 使用与 iOS 相同的基于 URL 的应用程序间通信系统,所以我认为必须有一种方法。 Like I said, this table is really just for me so if it works on my OS X laptop that's good enough for me.就像我说的,这张桌子真的只适合我,所以如果它可以在我的 OS X 笔记本电脑上运行,那对我来说已经足够好了。

I guarantee an up-vote to anyone who gives an answer that is at all useful.我保证任何给出完全有用的答案的人都会投赞成票。 Thanks so much to anyone who can help.非常感谢任何可以提供帮助的人。

PS To be clear, the HTML5 <time> tag is not a solution. PS 需要明确的是,HTML5 <time>标签不是一个解决方案。

While I was researching this question on my own I found a W3Schools article about the new HTML5 <time> tag .当我自己研究这个问题时,我发现了一篇关于新 HTML5 <time>标签的 W3Schools 文章 This would be exactly what I'm looking for, except that it does nothing.正是我正在寻找的,除了它什么都不做。 The <time> tag is theoretically implemented in all HTML5 compliant browsers, including Chrome, Safari, Firefox, Edge, and Opera. <time>标签理论上在所有兼容 HTML5 的浏览器中实现,包括 Chrome、Safari、Firefox、Edge 和 Opera。 But they only implement it in the sense that they are prepared to ignore it (as opposed to viewing it as a syntax error).但他们只是在他们准备忽略它的意义上实现它(而不是将其视为语法错误)。

Adding a <time> tag changes literally nothing about the UX of an HTML page.添加<time>标签实际上并没有改变 HTML 页面的用户体验。 It's useful only for deep internals of the browser or search engine presenting it.它仅对呈现它的浏览器或搜索引擎的深层内部有用。 In the W3Schools article they say...他们在 W3Schools 的文章中说……

Note: The time element does not render as anything special in any of the major browsers.注意:时间元素在任何主流浏览器中都不会呈现为任何特殊内容。

This element can be used to encode dates and times in a machine-readable way so that user agents can offer to add birthday reminders or scheduled events to the user's calendar, and search engines can produce smarter search results.此元素可用于以机器可读的方式对日期和时间进行编码,以便用户代理可以向用户的日历添加生日提醒或预定事件,并且搜索引擎可以生成更智能的搜索结果。

So I say again, I'm looking for something better than <time> elements.所以我再说一遍,我正在寻找比<time>元素更好的东西。

I can't find anything related to time in the IANA Uniform Resource Identifier (URI) Schemes so I don't think this available out of the box.我在IANA 统一资源标识符 (URI) 方案中找不到与时间相关的任何内容,因此我认为这不是开箱即用的。 Only option would be to add a custom protocol to the client's computer if that's possible.如果可能的话,唯一的选择是向客户端的计算机添加自定义协议。

Edit: Calender access protocol might be useful for you but I don't think this is the behaviour you are describing.编辑:日历访问协议可能对您有用,但我认为这不是您所描述的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM