How to get the value from the URL GET parameters in react native webview?

Shady Hakim

I have this response

webViewState Object {
  "canGoBack": true,
  "canGoForward": false,
  "loading": false,
  "navigationType": "other",
  "target": 65507,
  "title": "السداد بواسطة PayPal - راجع مدفوعاتك",
  "url": "https://example.com/?paymentId=PAYID-L2ILTHQ83R55588UV606981X&token=EC-5EB6693455269621L&PayerID=BLG98CXTZAX8S",
}

How can i access paymentId and PayerID parameters from the URL??

I tried this line but it returns undefined for both const { PayerID, paymentId } = webViewState.url;

Any help please?

user12129132

After getting your data you can do this:

var regexp = /[?&]([^=#]+)=([^&#]*)/g,params = {},check;
while (check = regexp.exec(webViewState.url)) {
  params[check[1]] = check[2];
}
console.log("params",params)

params will give you a object like this

Object {
  "PayerID": "BLG98CXTZAX8S",
  "paymentId": "PAYID-L2ILTHQ83R55588UV606981X",
  "token": "EC-5EB6693455269621L",
}

Hope this helps!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

React Native webview get url

Get value from input field in webview to react native

How to get parameters value as it is from the URL with JSP

How can I get cookies from react native webView on iOS?

React-native get cookies from WebView

How to get value from one of several possible URL parameters?

How to get parameters name and value from url using jquery?

How to get value of optional parameters from a url with regex in java

how to get image URL from different js file in react native

How to get title from url with react-native-link-preview

How to pass the parameters from react-native-webview to the javascript?

How to get JSON from webview with dynamic URL?

How to get the value from the GET parameters?

Get parameters value from another url

React Native - How to get Y Offset Value of a view from ScrollView?

How to get a return value from async function to a variable in React Native?

how to get value from react-native-numeric-input

How to get input value from react-native-element

How I get value from JSON React Native?

How to get field value from firestore database in react native

How to get value from TextInput and set it with Button React Native?

Get the value of URL Parameters

React native get url

React Native - Get value from component - onPress

get a value from an object react native

How get value from URL

How to get the html source of WebView object in react native

How can get cookie which is set in webview in react-native?

How to get parameters from the URL in JSF properly?