网页中包含javascript内容时未调用webViewDidFinishLoad [英] webViewDidFinishLoad not calling when having javascript content in webpage

查看:59
本文介绍了网页中包含javascript内容时未调用webViewDidFinishLoad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用 UIWebView .有时它不调用 webViewDidFinishLoad 方法.因为网页上有一些JavaScript.方法

I'm using UIWebView in a project. Sometimes it doesn't call the webViewDidFinishLoad method. Because the web page have some javascripts. The method

- (BOOL) webView: (UIWebView *) webView shouldStartLoadWithRequest: (NSURLRequest *) request navigationType: (UIWebViewNavigationType) navigationType

正在接到电话,但 webViewDidFinishLoad 没有.我想抓住那个方法.因为当Webview开始加载时,我正在启动动画.然后,我想在动画结束时停止播放.它不适用于具有javascript内容的网站.有人有主意吗?

is getting call but webViewDidFinishLoad doesn't. I want to catch that method. Because I'm start an animation when the webview start loading. Then I want to stop this animation when it finished. It's not working with websites having javascript content. Any one have an idea please?

谢谢

推荐答案

显然,ios中的Web视图专门检查html dom中的"iframe"标签,如果发现,它也会基于该标签创建事件.因此,一个简单但不完善的解决方案是在正在更改的dom部分中添加以下代码(例如,在每个部分的实际模板中):

apparently, the webview in ios checks specifically for "iframe" tags in the html's dom and in case it finds, it creates events based on that tag as well. therefore, a simple however a patchy solution would be adding the following code in the part of the dom that is changing (for example, in the actual template of each section):

<iframe></iframe>

是我的把戏.

这篇关于网页中包含javascript内容时未调用webViewDidFinishLoad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆