WebView events does not detect the url change
I want to navigate only to a youtube video and if I try to navigate to youtube home or another page inside youtube, i want to detect the url change and cancel it from loading. I have implemented the OnNavigating and OnNavigated event, a webview custom renderer to use ShouldOverrideUrl, PageStarted, PageFinished to detect the url change and nothing works. The only event that detect it is DoUpdateHistory but when it detect the url, the page is already loaded and i want to prevent loading another page.
It should be noted that when I try to navigate outside of YouTube, the events do work.
1 answer
-
JarvanZhang 23,971 Reputation points
Hello @Alan Rojas ,
Welcome to our Microsoft Q&A platform!
WebView events does not detect the url change
There are two ways to redirect web pages: Forward and Redirect. It exists a clear difference in the jump between the two ways.
Forward: The address bar of the browser URL remains unchanged.
Redirect: The address bar of the browser URL changes.The youtube api seems to use the Forward way to redirect the url. When clicking a tab on the youtube home page, the related event will not be called. But these events are triggered when testing google web. You could test it on your side to vertify that.
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
-
JarvanZhang 23,971 Reputation points
@Alan Rojas
May I know whether your issue has been solved or not? If not, please share it in here. We can work together to figure it out. -
Alan Rojas 1 Reputation point
I did not understand what you suggest me to do, sorry. I have not solve it yet.
-
JarvanZhang 23,971 Reputation points
I mean the issue is not due to the WebView, it's related to the working mechanism of the youtube api.
The following case explains the difference between the two ways, please check:
https://stackoverflow.com/questions/6068891/difference-between-jsp-forward-and-redirect
Sign in to comment -
