0x0001
0x0001

Reputation: 255

Opening external link in WebView

When I click on a link (let's say: www.facebook.com) and I choose my app to open it, the webview in my app always loads my home page, not the one I clicked on. What could be causing this?

The link

When I click on it:

It asks me with which one to open

I choose my browser (unnamed) and then:

Loads home page

Upvotes: 0

Views: 431

Answers (1)

Kevin LE GOFF
Kevin LE GOFF

Reputation: 770

The main problem you have is that you are opening google.com not the url that it pass to your application via the Intent mechanism.

To get the targeted url you need to parse the data from the intent with this.

Intent intent = getIntent(); link = intent.getDataString(); myWebView.loadUrl(link);

Upvotes: 1

Related Questions