简体   繁体   English

UIWebView iFrame从iOS10开始不起作用

[英]UIWebView iFrame not working as of iOS10

I have a UIWebView which contains iFrames that I dynamically load and manipulate with javascript. 我有一个UIWebView,其中包含我通过JavaScript动态加载和处理的iFrame。 My code worked in iOS 5 through 9. Suddenly it's broken in iOS 10! 我的代码在iOS 5到9中都能正常工作。突然间,它在iOS 10中坏了! Note this is in a cross platform app which also works with various flavors of webviews on Windows, Mac, and Android. 请注意,这是在跨平台应用程序中,该应用程序还可以与Windows,Mac和Android上的各种Webview一起使用。 They all work going back to versions of these platforms from many years ago through the present... Apple simply pulled the rug out from under me on this one! 它们都可以追溯到许多年前的平台,直到现在……苹果只是在这个平台上将地毯从我的下面拉了出来!

Has anyone else run into new behavior with iFrames as of iOS 10? 从iOS 10开始,还有其他人会遇到iFrames的新行为吗?

I solved the problem! 我解决了问题! The iFrame property "srcdoc" does not work the same in iOS 10. I have a line of code where I set that property to null . iFrame属性“ srcdoc”在iOS 10中无法正常工作。我在一行代码中将该属性设置为null I then set the "src" to some url. 然后,我将“ src”设置为某些网址。 Well, in iOS 10 the src change was not processed and the srcdoc change put the string "null" in the frame. 好吧,在iOS 10中,未处理src更改,并且srcdoc更改将字符串“ null”放入框架中。 That's screwy on both accounts! 这两个帐户都有问题! So, in this particular platform / version the problem was solved by simply dropping my srcdoc assignment altogether. 因此,在此特定平台/版本中,只需将我的srcdoc分配完全删除即可解决问题。 The src assignment is then respected. 然后遵守src分配。 I left it in place as it was for all my other webviews since this always worked before! 我将其保留在所有其他Webview的原处,因为这以前一直有效!

Watch out if you use both srcdoc and src in iOS apparently! 注意,如果您同时在iOS中同时使用srcdoc和src,请当心!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM