disorientedp
Mar 13, 2016 - 00:18
How can I get the URL of the currently loaded page in WebView?
How can I get the URL of the currently loaded page in WebView?
Why don't you make a delegate and set a global variable whenever should_start_load is called.
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 not load_url) to load the page perhaps?
I assume the currently displayed page comes from a load_url, not a load_html? The latter doesn't include any location information, so this applewebdata:// 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.