gpt4 book ai didi

iphone - 如何在 UIWebView 中通过 AngularJS 检测 url 更改

转载 作者:行者123 更新时间:2023-12-03 18:47:54 25 4
gpt4 key购买 nike

我正在使用 UIWebView,它加载使用 AngularJS 的网站的 url。当它加载新的 url (AngularJS 路由)时,它不会被 UIWebView delegate 检测到。我如何检测浏览器中的网址是否发生变化。

谢谢

最佳答案

加载角度后,从 window.location.href 获取当前 URL,而不是从 UIWebView (webView.request?.url?.绝对字符串)。

webView.stringByEvaluatingJavaScript(from: "window.location.href")

Reason: It's mainly because the URL is internally managed by the Angular router.

关于iphone - 如何在 UIWebView 中通过 AngularJS 检测 url 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42665629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com