Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the url of the webView

I have a Subview that load a Webview, i want to get the url of the webView when my webView load a site,can you tell me how to get the url of the webView. thank you.

like image 689
pengwang Avatar asked Feb 27 '11 08:02

pengwang


People also ask

What is WebView URL?

WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application. In order to add WebView to your application, you have to add <WebView> element to your xml layout file.

How do I get the current URL in react native WebView?

To get current URL with React Native webview, we can set the onNavigationStateChange prop to a function that listens for navigation events in the webview. to set onNavigationStateChange to the onNavigationStateChange function. In it, we log webViewState. url which has the URL of the current page in the webview.

How do I open a link in WebView?

Within the shouldOverrideUrlLoading() method simply get the URL from the request and pass into the Intent. See the full example.

Which method returns the URL of the current page in Android?

Using webview. loadUrl(url) method I open an url. If I click any Button on the view it directs to another page.


2 Answers

Assuming webView is the name of your WebView, you could use:

String webUrl = webView.getUrl();

See Here: http://developer.android.com/reference/android/webkit/WebView.html#getUrl()

like image 191
Will Tate Avatar answered Oct 04 '22 05:10

Will Tate


Also you can use this too

String webUrl = webView.getOriginalUrl();
like image 22
Aristo Michael Avatar answered Oct 04 '22 05:10

Aristo Michael