Android的v2.2-2.3.5:的WebView:loadDataWithBaseURL:只会加载页面一次 [英] Android v2.2-2.3.5: WebView : loadDataWithBaseURL : will only load page once

查看:652
本文介绍了Android的v2.2-2.3.5:的WebView:loadDataWithBaseURL:只会加载页面一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用加载页面 .loadData .loadDataWithBaseURL 时,系统会加载一个页面一次

之后,后续调用不起作用。

在4.0.3,如果我要调用的函数,第二次用新的数据,它会改变。

我怎样才能解决这个问题的2.2+?难道我破坏了网页视图,并创建一个新的?

  webView1.loadDataWithBaseURL(文件://,页,text / html的,UTF-8,NULL);
webView1.loadUrl(JavaScript的:window.location.reload(真));


解决方案

在loadDataWithBaseURL,设置的最后一个参数的地方是从哪里来该数据的URL,而不是的。

When I'm loading a page using .loadData or .loadDataWithBaseURL, the system will load a page once.

After that, subsequent calls do not work.

In 4.0.3, if I were to call the function a second time with new data, it does change.

How can I fix this for 2.2+? Do I destroy the webview and create a new one?

webView1.loadDataWithBaseURL("file://", page, "text/html", "UTF-8", null);
webView1.loadUrl( "javascript:window.location.reload( true )" );

解决方案

In loadDataWithBaseURL, set the last parameter to the URL where that data came from, instead of null.

这篇关于Android的v2.2-2.3.5:的WebView:loadDataWithBaseURL:只会加载页面一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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