我遇到了一个sharepoint网站的问题。
我给它验证了它的ntlm auth并将整个站点转换为字符串,
一旦我使用loadData();
将其加载到WebView中,我就看不到图像了。我认为它与.axd文件扩展有关,因为它隐藏了图像的完整URL。
答案 0 :(得分:0)
我知道如何解决它:
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");
}
}