1. Set JS pop-up window controller
Webview.jsdialoghandler = this; JS pop-up window control
2. Implementing the Interface method
Public BOOLOnjsalert (Iwebbrowser Browser,stringUrlstringmessage) {MessageBox.Show (message); return true;//Stop JS Bullets } Public unsafe BOOLOnjsconfirm (Iwebbrowser Browser,stringUrlstringMessageBOOL*retval) {DialogResult result= MessageBox.Show (Message,"Tips", Messageboxbuttons.yesno); BOOLValue = result = = Dialogresult.yes?true:false; //retval = (BOOL *) GCHandle.Alloc (value). Addrofpinnedobject (). ToPointer (); //get managed memory address, exception//retval = &value;//failed to change pointer*retval =value; return true; } Public unsafe BOOLOnjsprompt (Iwebbrowser Browser,stringUrlstringMessagestringDefaultValue,BOOL* RetVal,ref stringresult) { //Interactive Messages stringR =string. Empty; This. Invoke (NewAction (() ={R= Microsoft.VisualBasic.Interaction.InputBox (Message,"Tips", DefaultValue); })); Result=R; if(Result = =DefaultValue) { *retval =false; } Else { *retval =true; } return true; }