Get current ui.WebView URL
-
How can I get the URL of the currently loaded page in WebView?
-
web_view.eval_js('window.location.href')
-
@omz's solution is far more elegant, disregard my answer.
-
@omz I didn't think of JavaScript. Thanks!
-
@omz Weird. That always returns a url starting with applewebdata://
-
@disorientedp Did you use
load_html
(and notload_url
) to load the page perhaps?
-
I assume the currently displayed page comes from a
load_url
, not aload_html
? The latter doesn't include any location information, so thisapplewebdata://
URL is probably used as a substitute.
-
@dgelessus yes, it comes from load_url
-
Maybe the page hasn't finished loading yet when you call this?
-
@omz Oh. That worked.