【问题标题】:Website not loading properly inside WebView Android网站无法在 WebView Android 中正确加载
【发布时间】:2016-02-29 15:10:12
【问题描述】:

我正在尝试使用 WebView 在应用程序中加载此 URL http://www.uramus.com。问题是我得到的只是页面的背景(蓝屏),没有加载网页的元素。虽然这在完全加载页面的 Android 默认浏览器中从未发生过。为什么会这样?

这是我的代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    ActionBar ab = getSupportActionBar();
    ab.hide();

    wb = (WebView) findViewById(R.id.wb);
    pg = (ProgressBar) findViewById(R.id.pg);

    wb.getSettings().setJavaScriptEnabled(true);     
    wb.getSettings().setLoadWithOverviewMode(true);
    wb.getSettings().setUseWideViewPort(true);        
    wb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    //wb.setWebViewClient(new MyClient());

    wb.loadUrl("http://www.uramus.com/#/new-releases");
}

【问题讨论】:

  • 您的网站正在使用 Flash 吗??
  • 其实网站使用的是 Spotify 和 Youtube APIs

标签: android webview


【解决方案1】:

在您的 web 视图中,您收到异常 uncaught typeerror cannot read property

这行代码解决了。

webview.getSettings().setDomStorageEnabled(true);;

【讨论】:

  • 您好!谢谢你的帮助。你能解释一下为什么会这样吗?
  • 我也添加了这一行。只显示欢迎信息,不显示其他元素。
  • 您在哪里运行您的应用模拟器或设备。?
  • 在将显示的设备上运行您的 apk。
  • 我只在设备上运行它
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-29
相关资源
最近更新 更多