问题描述
如何使用WKWebView或UIWebView获取网站的apple-touch-icon或徽标?我读过有可能获得favicon,但是我打算像在iOS Safari中那样将网站徽标用作快捷方式,而favicon太小了.有没有一种方法可以从webView的网站中刮取元数据以获取<link rel="apple-touch-icon" href="apple-touch-icon.png">
?
How can I get the apple-touch-icon or logo of the website using WKWebView or UIWebView? I've read that getting a favicon is possible, however I plan on using the website's logo as a short cut like in iOS Safari and a favicon is too small for it. Is there a way to scrape metadata from a website in webView to get <link rel="apple-touch-icon" href="apple-touch-icon.png">
?
推荐答案
在iOS的Firefox中,我们使用用户脚本(链接到Github上的代码)以找到图标,然后将其传递回应用程序,该应用程序使用本地代码(链接到Github上的代码).
In Firefox for iOS we use a User Script (Link to code on Github) to find the icon that then passes them back to the application which downloads them using native code (Link to code on Github).
这篇关于WKWebView/UIWebView获取网站图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!