I’m developing a Flutter application that uses a webview. While navigating from a DocuSign form and clicking back it displays this confirm navigation dialog (see below). It took me forever to find out this is a weird Android application confirmation screen and not a Flutter or DocuSign dialog. How can I prevent this dialog from displaying?
FYI: I’ve tried injecting JavaScript without success. I’m still getting this message even after injecting it onPageFinished of the webview.
Again is there a way to just block this message from ever showing up?
void _injectPopupAvoidJavaScript() {
const String js = """
alert('test');
window.addEventListener('beforeunload', function (e) {
e.preventDefault();
e.returnValue = '';
});
""";
_webViewController.runJavaScript(js);
}