Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
WebView bug
-
In both the latest betas (Pythonista2 and Pythonista3) when running
web_view.eval_js('alert(document.title)')
, the alert is unable to be dismissed.Test code:
import ui web_view = ui.WebView(frame=(0,0,500,500)) web_view.present('sheet') web_view.load_url('https://www.google.com') web_view.eval_js('alert(document.title)')
-
I see, I'm not completely sure about the best way to fix this yet, but here's a possible workaround:
import ui from objc_util import ObjCInstance, on_main_thread web_view = ui.WebView(frame=(0,0,500,500)) web_view.present('sheet') web_view.load_url('https://www.google.com') js = 'alert(document.title)' wv = ObjCInstance(web_view).subviews()[0] on_main_thread(wv.stringByEvaluatingJavaScriptFromString_)(js)
-
I can confirm that this is still a bug on iOS 9.3 beta, where all the web dialogs were redone.