0

I am using react-native-webview. I am adding static HTML content into it, with baseUrl for relative path. { console.log(navState); }} /> on Clicking a link there in Webview, getting the below log: { canGoForward: false, canGoBack: false, title: "", loading: true, url: "data:text/html;charset=utf-8;base64,", …}

How to get the exact url? I'm trying this on Android Emulator

Shahid Anjum
  • 148
  • 1
  • 5

1 Answers1

2

Assuming that you're referring to navState object of the onNavigationStateChange function when you did the following:

onNavigationStateChange={navState => { //some logic }}

The navState object includes these properties:

canGoBack
canGoForward
loading
navigationType
target
title
url

In fact, you console logged the navState object.

To get the URL, use navState.url. Hence console.log(navState.url) would log the URL.

Note: This method will not be invoked on hash URL changes. See this.

Vignesh V Pai
  • 699
  • 4
  • 7
  • Thank Vighnesh for answering. There was issue with my "baseUrl" as the right url was not being passed was causing the issue. It is fixed now by correcting the baseUrl. – Shahid Anjum Oct 28 '19 at 06:32