Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在付款后将用户重定向回应用程序?_Javascript_Node.js_React Native - Fatal编程技术网

Javascript 如何在付款后将用户重定向回应用程序?

Javascript 如何在付款后将用户重定向回应用程序?,javascript,node.js,react-native,Javascript,Node.js,React Native,流程如下所示: 1. User taps on "Pay Now" in the app. 2. An in-app WebView will be opened up and user will be required to make the payment in a third-party payment page. 3. After payment, user will be redirected to another link. 我们如何在付款后将用户带回应用程序?我们应该使用Dee

流程如下所示:

1. User taps on "Pay Now" in the app.
2. An in-app WebView will be opened up and user will be required to make the payment in a third-party payment page. 
3. After payment, user will be redirected to another link.
我们如何在付款后将用户带回应用程序?我们应该使用Deeplink还是URL更改侦听器

  • 对于Deeplink,即使是应用程序内的webview,是否也会提示用户弹出窗口?这不是我们想要的理想行为 我们希望在第3步(对于iOS和Android)之后能够顺利过渡回应用程序


    我们使用React-Native作为前端,Nodejs作为后端。

    我以前已经实现了这个简单的解决方案。使用web视图,我正在检查url以了解是否已完成:

    checkUrlState = (url) => {
        if (url.includes('specific/part/of/your/url')) {
          // code to hide WebView
        } 
    }
    
    <WebView
      ...yourOtherProps
      onNavigationStateChange={state => this.checkUrlState(state.url)}
    />
    
    checkUrlState=(url)=>{
    if(url.includes('specific/part/of/your/url')){
    //隐藏WebView的代码
    } 
    }
    this.checkUrlState(state.url)}
    />
    
    简单而有效