I’m embedding a SharePoint Online portal page inside an Android WebView. From the top page,when i click the menu item to load a Addressbook page, The page loads correctly the first time, but when I click the same link again (subsequent navigation), the page never finishes loading. This problem happens only on Android (Similar implementation on iOS seems to load the page every time)
However, if i go back to the top page again and click the Addressbook page, it loads (since it's the first time i load it directly from top page)
I have set these WebviewSettings
webView.settings.javaScriptEnabled = true
webView.settings.domStorageEnabled = true
CookieManager.getInstance().setAcceptCookie(true)
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
What I observe ,
1. Using Chrome DevTools via remote debugging)
1.1 . First (working) navigation shows Microsoft Graph calls gets executes and succeeds:
OPTIONS https://graph.microsoft.com/v1.0/groups/66ae1ee4-00ee-4a28-8a63-b7a844cedb8f HTTP/1.1
Host: graph.microsoft.com
Connection: keep-alive
Accept: /
Access-Control-Request-Method: GET
Access-Control-Request-Headers: authorization,client-request-id,sdkversion
Origin: https://app.sharepoint.com
1.2 . Second (failing) navigation: I do not see Graph calls at all. Instead I see multiple
https://res.cdn.office.net/midgard/versionless/...
- On Android Studio
2.1. onPageStarted doesn't gets called on first time. Second time onwards it gets called.
2.2. onReceivedTitle gets executed always
public final class WebViewClient extends WebViewClient {
@Override
public void onPageStarted(final WebView view, final String url, final Bitmap favicon) {
this.mClient.onPageStarted(url);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
this.mWebView = new WebView();
this.mWebView.setWebChromeClient(new WvWebChromeClient(client));
}
}
I'm not sure why it's not loading after the first load. Please let me know if you have any ideas, why this behavior happens.