react-native-webview: is there a way to determine when we are done redirecting (with multiple redirections)?

huangapple go评论46阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年2月6日 17:41:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359597.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定