Webview Redirection Issues

In my e-commerce application, I redirect the user to a web view to pay for the order. In my web review, he asks the user for a login using Google Plus. When the user clicks the Google+ button, a child window opens and, after successful authentication, the result is sent back to the parent window, and in the parent window, redirection occurs from the login screen to the page where the user came from. [Ex - Product Details Page, Cart Page, etc.].

So, the problem here is when I open the link in the Android web browser.

webview.loadUrl(url); 

It opens as soon as the user clicks on the G + redirect, and the parent page is deleted, and g + authentication starts. After successful authentication control, a parent window is provided, but at this time the parent element is missing and all parent JavaScript objects were replaced by the child window earlier.

I'm here, my redirect takes in the wrong place.

+6
source share
1 answer

getOriginalUrl ()

It returns the URL that was originally requested for the current page

getUrl () does not always match the URL passed to WebViewClient.onPageStarted, because although loading for this URL has begun, the current page may not have changed.

getOriginalUrl () gets the source URL for the current page. This does not always match the URL passed to WebViewClient.onPageStarted, because although the download for this URL has started, the current page may not have changed. In addition, there might have been redirects, which resulted in a different URL being requested.

-one
source

Source: https://habr.com/ru/post/1012095/


All Articles