WebView has getUrl() and it has loadDataWithBaseUrl() but I can’t find a method that returns the base URL (note: “base URL” is not the same as server/host path).
Is there a way to find the base URL of the current web page, even for pages that don’t use the tag, but do use relative URLs in links contained in the page?
Note the complexity of the problem:
- getUrl() isn’t always the base URL.
- Server/host path isn’t always the base URL.
- Web pages don’t always contain the
<base>tag.
This may explain why there isn’t a single WebView method to provide the base URL…
You can do:
With the
URLobject, you can do get things like path, host, etc. Check out the docs for more info.