Android Webview unable to load Sharepoint Website

851 Views Asked by At

I am having a problem with a sharepoint site. I have given it authentication for it's ntlm auth and converted the whole site into a string, and once i load it into the WebView using loadData(); I can't see the images. I think it has something to do with the .axd file extenstion as it hides the full url of the images.

1

There are 1 best solutions below

0
On

I know how to fix it:

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");




    }

}