Is there a way to detect if a popup is currently being displayed in an Android webview? -
i have android app webview displays form bunch of controls on it. tapping on 1 of controls results in popup being displayed. there way detect if popup active in webview?
i've made 2 assumptions because question came across vague:
- case 1:popup in dialog showing
- case 2:popup in ad showing
for case 1: can think off 2 ways around this.
via android documentation here can call isshowing() method determine if dialog (popup) showing, return true.
the other way.
going limited information...have tried setting implementing web interface class , calling function indicate whether dialog showing? this.
public class webappinterface { context mcontext; /** instantiate interface , set context */ webappinterface(context c) { mcontext = c; } /** inform user dialog being displayed */ @javascriptinterface public boolean dialogisshowing() { // toast.maketext(mcontext, "the dialog showing!", toast.length_short).show(); return true } } ...
//code embeded html display dialog <script type="text/javascript"> function showcranialsurgesdialog() { android.dialogisshowing() } </script> //handle result of dialog showing if (dialogisshowing()==true){ //do } for case 2: popup in ad showing
my best guess use the: 'webviewsettings.setjavascriptcanopenwindowsautomatically(false)' method. stops windows opening automatically theory not experience may prevent problem. documentation here
lasty may helpful if case 1 stuck on. click me
hope helps, jonny 2 plates
Comments
Post a Comment