自定义链接前缀如何工作?(像Steam://)

编程入门 行业动态 更新时间:2024-10-23 04:36:25
本文介绍了自定义链接前缀如何工作?(像Steam://)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我真的很好奇自定义链接前缀是如何工作的(我真的不知道它们叫什么),而且我在网上找不到任何任何东西.没有.

I was really curious about how custom link prefixes work (I really have no clue what they are called), and I couldn't find anything online about it. None.

如果有人知道它是如何工作的,并且/或者可以向我指出教程的方向,那会让我感到惊讶.

If anybody knows how this works, and/or could point me in the direction of a tutorial, that would me amazing.

我确实找到了有关在iOS中执行此操作的教程,但PC/Windows应用程序需要它.

I did find a tutorial on doing this in iOS, but I need this for a PC/Windows app.

推荐答案

这些前缀称为 URI方案 并被引入以允许跨应用程序引用事物.因此,这些前缀是 统一资源标识符 的第一部分.

These prefixes are called URI Schemes and are introduced to allow referencing things across applications. Thus, these prefixes are the first part of a Uniform Resource Identifier.

作为大公司,在 steam 的情况下,Valve似乎过度使用URI方案,而没有真正遵循 RFC 4395 .如果您打算使用这种方案,强烈建议您阅读它,至少部分2.8 .这将确保您的方案不会与其他行为良好的应用程序冲突.如有疑问,请在他们的邮件列表上询问.

Big companies as Valve in the case of steam seem to use URI Schemes quite excessively, without really following RFC 4395. If you plan to use such a scheme, I highly encourage you to read it, at least Section 2.8. This will make sure that your scheme does not collide with other well-behaved applications. If in doubt, ask on their mailing list.

对于技术实现,如何实现对URI方案的支持在很大程度上取决于应用程序.例如,Steam通过操作系统级别的处理程序使用其架构来启动游戏或通过浏览器控制Steam客户端.因此,其URI以某种方式引用了本地安装的Steam客户端.作为另一个示例, http 用于引用特定主机上的内容.尽管 steam 是通过操作系统级别的功能和本地客户端使用的,但 http 通常完全由浏览器处理.第三个示例是 tel URI,它引用电话号码,并且不直接映射到特定的应用程序,但通常也不由浏览器处理.因此,您应该查看应该了解您的URI的客户端应用程序文档,并搜索实现功能所需的API.

For the technical implementation, how to implement support for a URI Scheme is heavily application-dependent. Steam, for instance, uses its schema through OS-level handlers for things like starting games or controlling the steam client through the browser. Its URIs thus somehow reference the locally installed steam client. http, as a different example, is used to reference content on a specific host. While steam is used using OS-level features and a local client, http is usually completely handled by the browser. A third example are tel URIs, which reference telephone numbers and are not directly mapped to a specific application, but also usually not handled by the browser. Thus, you should look into the documentation of the client application that should understand your URIs, and search for the APIs required to implement your functionality.

如果您有兴趣在Windows上的本地应用程序中处理URI方案,请已经有一个问题.

If you are interested in handling your URI scheme within a local application on Windows, there's a question covering that already.

更多推荐

自定义链接前缀如何工作?(像Steam://)

本文发布于:2023-11-28 06:53:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641364.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:前缀   自定义链接   工作   Steam

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!