Reputation: 2034
Is there any method to know whether the url being loaded in the webview is either redirecting
to any other page or not ?
E.g
I have an Edittext where I search for "car" .Now , result page for "car" is
loaded in the webview below. In the result page , I click for wikipedia link.
There, First url loaded is "https://en.wikipedia.org/wiki/Automobile" which
automatically gets redirected to "https://en.m.wikipedia.org/wiki/Automobile".
I want to know this redirection.
Actually , I want to find whether the url loaded in webview is redirecting or not.
If it's redirecting ,then,I want to capture it and take some actions.
Thank you in advance.Any help would be great.
Upvotes: 1
Views: 1972
Reputation: 231
Yes, look at WebViewClient.onPageStarted(). When called (upon each redirection) you can get the url via the WebView
view parameter: view.getUrl()
.
Upvotes: 4