Instagram嵌入不在某些移动设备上

问题描述 投票:0回答:1

它加载占位符“在Instagram上查看此帖子”而不是嵌入式媒体。使用标准Instagram嵌入代码,这在同一设备上的Chrome和Firefox浏览器中都会发生。有趣的是,它发生在Android和iOS上,但仅限于我测试的少量设备。

任何的想法?

Instagram embed

android-webview embed wkwebview instagram-api
1个回答
0
投票

我在iOS 12中使用WKWebView遇到了同样的问题。对我有用的解决方案是使用带有“/ embed”标准链接的iframe作为最后一个路径元素,而不是Instagram提供的嵌入代码。 viewDidLoad()中的示例:

let embed = "<iframe src=\"https://www.instagram.com/p/BwdGxDGAOcP/embed\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowtransparency=\"true\"></iframe>"
let config = WKWebViewConfiguration()
config.allowsInlineMediaPlayback = true
let webview = WKWebView(frame: view.frame, configuration: config)
webview.uiDelegate = self
view = webview
webview.loadHTMLString(embed, baseURL: nil)
© www.soinside.com 2019 - 2024. All rights reserved.