【问题标题】:How can I install a plugin for WKWebView with Swift?如何使用 Swift 为 WKWebView 安装插件?
【发布时间】:2018-03-21 13:54:53
【问题描述】:

我正在尝试在我的 WKWebView 中实现 web.skype.com 来呼叫某人。但总是出现一条消息,我必须为 Skype 通话安装插件。 我尝试更改用户代理,但它不起作用,消息仍然出现。

我的代码:

  let url = URL (string: "https://web.skype.com/")
    var requestObj = URLRequest(url: url!)
    let userAgent = "Mozilla/10.0 (Macintosh; Intel Mac OS X 10_30_2) AppleWebKit/902.3.12 (KHTML, like Gecko) Version/99.0.2 Safari/902.3.12"
    requestObj.setValue(userAgent, forHTTPHeaderField: "User-Agent")
    webView.isUserInteractionEnabled = true
    webView.configuration.allowsAirPlayForMediaPlayback = true
    webView.configuration.allowsInlineMediaPlayback = true
    webView.configuration.allowsPictureInPictureMediaPlayback = true
    webView.customUserAgent = userAgent

 webView.load(requestObj)

【问题讨论】:

    标签: ios swift wkwebview skype


    【解决方案1】:

    不能在 Safari for iOS(Content Blocking Safari Extensions 除外)中安装插件,也不能在 WKWebView/UIWebView 中安装插件。

    如果您希望用户使用 Skype 应用程序进行通话,您应该将其重定向到该应用程序。 Here is an answer under another question that addresses that issue.

    【讨论】:

    • 你的意思是,它不能正常工作,但我可以通过使用内容阻止扩展来做到这一点。对吧?
    • @AkifDemirezen 不,您不能使用内容阻止扩展程序进行呼叫。我刚刚补充说,iOS Safari 存在扩展确实
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-06
    • 2013-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-11
    • 1970-01-01
    相关资源
    最近更新 更多