以编程方式在阅读器模式下打开 Safari

发布于 2024-11-28 08:24:05 字数 46 浏览 4 评论 0原文

是否可以以编程方式在阅读器模式下打开 Safari 和/或移动 Safari?

Is it possible to programmatically open Safari and/or mobile Safari in Reader mode?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

予囚 2024-12-05 08:24:05

阅读器功能似乎部分源自可读性项目。可能值得阅读一些可以更详细地了解读者的资源。一些很好的起点,以及其他资源的链接:

关于操作 Safari/阅读器,我不知道 Apple 提供了任何相关 API,如果他们提供将网站放入阅读器的特定代码,我会感到惊讶模式。毕竟,如果遵循标准人机界面指南,调用此功能的选项实际上应该由用户启动。

The reader functionality appears to be derived, in part, from the Readability project. It might be worth reading up on a few of the resources out there which look at reader in more detail. Some good starting points, and links to other resources:

With regards manipulating Safari / reader, I'm not aware of any relevant API offered by Apple, and I'd be surprised if they offered specific code to put a site in reader mode. After all, the option to invoke this functionality should really be user-initiated if one is going by standard human interface guidelines.

原野 2024-12-05 08:24:05

如果您的用例适用于在应用程序中加载 SFSafariViewController 而不是打开 Safari 应用程序,您可以通过配置将阅读器模式设置为 true

import SafariServices

let config = SFSafariViewController.Configuration()
config.entersReaderIfAvailable = true
let safariVC = SFSafariViewController(url: aURL, configuration: config)

It it works for your use case to load SFSafariViewController within the app instead of opening Safari app, you can set reader mode to true via config

import SafariServices

let config = SFSafariViewController.Configuration()
config.entersReaderIfAvailable = true
let safariVC = SFSafariViewController(url: aURL, configuration: config)
再浓的妆也掩不了殇 2024-12-05 08:24:05

如果您有 URL,则可以使用 UIApplicationopenURL 方法,该方法将为您打开该 URL。

If you have a URL, then you can use the openURL method of UIApplication which will open the URL for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文