Android Webview无法加载Sharepoint网站
问题描述:
我遇到与SharePoint站点有关的问题。 我已经给它的身份验证它的ntlm身份验证,并将整个网站转换为一个字符串, 和一旦我加载到WebView使用loadData();
我看不到图像。我认为它与.axd文件扩展有关,因为它隐藏了图像的完整url。Android Webview无法加载Sharepoint网站
答
我知道如何解决它:
package com.example.yourapp;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.net.http.SslError;
import android.os.Bundle;
import android.webkit.*;
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" })
public class Sharepoint extends Activity {
private WebView webView;
@SuppressLint("NewApi")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sharepoint);
CookieSyncManager.createInstance(this);
CookieManager cookieManager = CookieManager.getInstance();
String cook = null;
cookieManager.setCookie("yoursite", cook);
CookieSyncManager.getInstance().sync();
webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient()
{
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
{
handler.proceed();
}
public void onProgressChanged(WebView view, int progress)
{
}
});
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setAllowContentAccess(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAllowUniversalAccessFromFileURLs(true); webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setAppCacheEnabled(true);
try {
Thread.sleep(300);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
webView.loadUrl("yoururl");
}
}
尝试用'loadDataWithBaseURL'加载数据,而不是使用'loadData' – Zyber 2013-04-24 07:54:07
@Zyber,我想,前一段时间,但图像不加载,是换成一个问号。 – 2013-04-24 08:00:27