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.
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.
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.
Within the shouldOverrideUrlLoading() method simply get the URL from the request and pass into the Intent. See the full example.
Using webview. loadUrl(url) method I open an url. If I click any Button on the view it directs to another page.
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()
Also you can use this too
String webUrl = webView.getOriginalUrl();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With