英文:
react-native-webview: is there a way to determine when we are done redirecting (with multiple redirections)?
问题
使用 react-native-webview
,我将用户重定向到一个会多次重定向的URL,但我不知道有多少次重定向,甚至不知道最终的URL。有没有办法知道webview何时完成重定向?
英文:
Using react-native-webview
, I redirect my users to an URL that will redirect to other URLs that will all redirect, multiple times.
I don't know how many redirections there are, or even the end-URL.
Is there a way to know when the webview is done redirecting?
答案1
得分: 1
你可以在客户端访问最终URL时向您的服务器发送一条消息,表明网站已完成重定向。如果您不拥有客户端被重定向到的URL,您必须知道客户端被重定向的次数,以便您可以使用客户端的默认ping加上一个缓冲来计算一个时间估计值...
类似这样:done_redirecting = avg_ping * redirecting_amount + buffer
请注意,这只是伪代码和理论性的。
英文:
You could send a message from the end-URL to your server when the client lands on it, which idicates that the website is done redirecting. If you don't own the URLs where your client gets redirected to, you must know how many times the client gets redirected, so you can calculate a time-astimate with the default ping of the client plus a buffer...
Something like that: done_redirecting = avg_ping * redirecting_amount + buffer
Please note that this is pseudo-code and theoretical.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论