Alert dialog from <webview> was blocked
more Clarification on @Xan Answer:
you need to listen to the dialog event from the webview ,Please read the comments in the code to understand better , again, I am using nwjs, so you can implement similar version in your language:
//lets listen to alert dom and enable it webview.addEventListener('dialog',function(e){ //message type messageType = e.messageType; messageText = e.messageText; DialogController = e.dialog; //lets checki if alert if(messageType == 'alert'){ window.alert(messageText); }//emd if //if confirm else if(messageType == 'confirm'){ //confirm var confirm = window.confirm(messageText); //get confirm bool and send to controller if(confirm == true){ //if true send okay to browser DialogController.ok(); }else{ //send cancel with to send false false DialogController.cancel(); }//end if }//end if confirm //lastly if its prompt else if(messageType == 'prompt'){ //get user Input promptInput = window.prompt(messageText); //if null , then means the user clicked cancel if(promptInput == null){ //tell browser to cancel DialogController.cancel(); }else{ //feed browser with input data DialogController.ok(promptInput); } }//end if prompt});//end dialog test
A webview cannot show those by default.
You need to catch the dialog
event, show your own UI for it (remember, Apps can't use alert
and friends, so a <dialog>
is a good option) and then pass the response back with DialogController