简体   繁体   English

在 iOS 中,有没有办法检测 web 页面是否加载了 SFSafariViewController 与普通的 Safari 浏览器使用 Z4A9E13B6ACAAAF755

[英]in iOS, is there a way to detect if a web page is loaded with SFSafariViewController vs the normal Safari Browser using Javascript?

Is there a way to detect if a web page is loaded with SFSafariViewController vs the normal Safari Browser using Javascript?有没有办法检测 web 页面是否加载了SFSafariViewController与使用 Javascript 的普通 Safari 浏览器?

    @supports (-webkit-touch-callout: none) {
  /* CSS specific to iOS devices */ 
}

@supports not (-webkit-touch-callout: none) {
  /* CSS for other than iOS devices */ 
}

You can check for the existence of the obscure system font .Helvetica LT MM in a canvas.您可以检查 canvas 中是否存在晦涩的系统字体.Helvetica LT MM Use the following Github Gist, and then call isInsideSFSafariViewController() .使用以下 Github Gist,然后调用isInsideSFSafariViewController()

Note that this can break at any time with a new release, so your code should gracefully fall back.请注意,随着新版本的发布,这可能随时中断,因此您的代码应该优雅地回退。

https://gist.github.com/aeharding/08eaafbb7742f78ede9b8d2f5d096354 https://gist.github.com/aeharding/08eaafbb7742f78ede9b8d2f5d096354

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

相关问题 有没有办法在 iPhone/iOS Safari 浏览器中调试 JavaScript? - Is there a way to debug JavaScript in the iPhone/iOS Safari browser? 在JavaScript中检测Safari浏览器 - Detect Safari browser in javascript 检测用Javascript加载的页面 - Detect page loaded with Javascript 在 iOS 上,有没有办法检测在嵌入式浏览器中运行的 web 页面并打开“真实”页面? - On iOS, is there a way to detect a web page runs in the embedded browser and open the "real" one? 如何使用Javascript检测浏览器是否为Safari 5+? - How can I detect if a browser is Safari 5+ using Javascript? 使用Javascript检测iOS Safari中的摇晃? - Detect a shake in iOS Safari with Javascript? 如何检测您的站点是否在SFSafariViewController上加载 - How to detect if your site is loaded on SFSafariViewController 有没有一种方法可以使用JavaScript在这种状态下检测Safari? - Is there a way to detect Safari in this state with JavaScript? Javascript:加载页面后,是否有任何方法可以禁止使用通过浏览器加载的.js文件? - Javascript: after loading a page, is there any way to inhibit the use of a .js file loaded using the browser? iPad Web 应用程序:使用 JavaScript 在 Z50DE9BC68C93DC32D8C7C905976 中检测虚拟键盘 - iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM