在 WebHistoryItem
的文档说:
Return the url of this history item. The url is the base url of this history item. See getTargetUrl() for the url that is the actual target of this history item.
Return the original url of this history item. This was the requested url, the final url may be different as there might have been redirects while loading the site.
这让我够困惑的了。我想知道的是,它们之间有什么区别?你能给我一些例子吗?
提前致谢。
最佳答案
嗯,在我做了一些研究之后,我发现了它们之间的差异。 原始URL是重定向之前的URL。假设您打开像这样的短链接 https://bit•ly/sG98iK
,那么您将被重定向到具有以下 URL https://example.com/的网页android/tutorial/webview.html
。我们将 https://bit•ly/sG98iK
称为原始 URL,https://example.com/android/tutorial/webview.html
as URL,即重定向后的URL。
请注意,原始 URL 可以为空。
关于android - Web历史记录项目 : URL vs Original URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49525740/