我试图在我的 ionic 应用程序中显示一个 iframe,但不知何故,它出现在浏览器上,但没有出现在 iOS 设备上。我想用html代码填充它。 我的代码:
<ion-content>
<iframe width="300px" height="325px" frameborder="0" scrolling="yes" marginwidth="0" marginheight="0" ng-attr-srcdoc="{{model.html}}">
</iframe>
</ion-content>
最佳答案
问题是,默认情况下,Cordova 不支持 srcdoc。最新版本的 Cordova 的解决方案很简单。编辑项目的 config.xml 并添加:
<allow-navigation href="about:*" />
我已经在 Cordova 6.4.0 上对此进行了测试,它解决了这个问题:它允许带有 iframe 的 Cordova 应用程序使用 srcdoc。
(接受的答案不正确。iOS 很好地支持 iframe。marshall119us 的答案对于以前版本的 Cordova 是可以的,但是已经过时了。)
关于javascript - 内部带有 html 的 cordova iframe 未在 iOS 设备上显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39165545/