3

I'm making an app that needs to show a simple webview that contains the page of a linkedIn contact.

The URL according to what i've seen is supposed to be :

http://www.linkedin.com/profile/view?id=XXX

where XXX is the id of the contact.

For some reason, I keep getting only the logo of LinkedIn instead of the real webpage.

I thought it's because of redirection issues, but I'm not sure.

Here's the code:

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mWebView = (WebView) findViewById(R.id.webView);
    final WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setBuiltInZoomControls(true);
    final String url = ...
    mWebView.loadUrl(url);
    // needed in order to support javascript alerts and other javascript operations
    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
            super.shouldOverrideUrlLoading(view, url);
            view.loadUrl(url);
            return true;
        }

    });
}

I've tried returning false too, but it doesn't work. It's probably a very tiny mistake.

Can anyone help?


EDIT: seems like using the user agent of a desktop web browser fixed it, but now it doesn't have the same look & feel of a mobile web browser.

Community
  • 1
  • 1
android developer
  • 114,585
  • 152
  • 739
  • 1,270

1 Answers1

5

The answer is that I had to call:

settings.setDomStorageEnabled(true);
android developer
  • 114,585
  • 152
  • 739
  • 1,270