weixin_33691598 2012-02-26 20:01 采纳率: 0%
浏览 31

Android 2.3.3 Webview

Trying to create a very basic app that has a webview. The webview will load a webpage that uses some javascript to make Ajax calls and update itself every few seconds.

My Android app works fine, I can load my page and it works as expected on any Android version after 2.3.3. In 2.3.3 the page loads, basic javascript seems to work, but it will not load the data from the Ajax calls. I can open this page directly in browser on 2.3.3 and it loads fine with Ajax calls updating the web browser.

I noticed that this was added in API 11, Which looks like what I need, but since it did not exist before 11, is there anything that could help? Since it works in the stock browser I would think it should work in webview??

public void setAllowContentAccess (boolean allow) Since: API Level 11 Enable or disable content url access within WebView. Content url access allows WebView to >load content from a content provider installed in the system. The default is enabled.

Let me know, thanks

Here is the code I am using, the url is stored in a system preference.

    WebView myWebView = (WebView) findViewById(R.id.webview);
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setUserAgentString(preferences.getString("deviceID", null));
    myWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    myWebView.addJavascriptInterface(new JavaScriptInterface(this), "Android");
    myWebView.clearCache(true);

    String defaultURL = preferences.getString("url1", null);
    myWebView.loadUrl(defaultURL);

B

  • 写回答

2条回答 默认 最新

  • weixin_33725239 2012-02-26 21:45
    关注

    Have you enabled javascript on the webview?

    myWebView.getSettings().setJavaScriptEnabled(true);
    
    评论

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)