Unwanted "Javascript Confirm" Dialog

163 views Asked by At

I'm using Crosswalk Embedding API (22.52.561.4) to wrap a web app inside of a Xwalk web view. Everything works fine, including a handful of Javascript interface functions between the web app and the native app.

But, for some reason Crosswalk throws up a native Android dialog with the title "Javascript Confirm" with the options "Cancel" and "OK" at seemingly random times. I have not coded any native dialogs into the app, and I don't know what is causing it to appear.

I can't find any mention of this dialog in the docs. I only know that it's coming from Crosswalk because this exact text appears in several places in the Crosswalk library, for example:

//xwalk_core_library\22.52.561.4\res\values\android_xwalk_strings.xml
<string name="js_confirm_title">"Javascript Confirm"</string>

Selecting "OK" reloads the webview, while selecting "Cancel" simply closes the dialog.

My app's activity:

public class MyActivity extends XWalkActivity {
  private XWalkView xWalkWebView;
  private XWalkSettings webSettings;

  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    xWalkWebView = (XWalkView)findBewById(R.id.webview);
    XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
  }

  protected void onResume() {
    super.onResume();
  }

  public void onXWalkReady() {
    xWalkWebView.load("http://my.web.app", null);
  }

  protected void onStart() {
    super.onStart();
    xWalkWebView.setResourceClient(new XWalkResourceClient(xWalkWebView) {
      public void onLoadFinished(XWalkView view, String url) {
        super.onLoadFinished(view, url);
      }  

      public boolean shouldOverrideUrlLoading(XWalkView view, String url) {
        if (!url.equals("http://my.web.app") {
          Intent i = new Intent(Intent.ACTION_VIEW);
          i.setData(Uri.parse(url));
          startActivity(i);
          return true;
        }
        else {
          return super.shouldOverrideUrlLoading(view, url);
        }
    }

    xWalkWebView.setUIClient(new XWalkClient(xWalkWebView));

    class JSBridge {
      private Handler handler = new Handler();
      public void loggedON() {
        handler.post(() > {
          Log.i(TAG, "user was logged in");
        });
      }
      public void loggedOFF() {
        handler.post(() > {
          Log.i(TAG, "user was logged out");
        });
      }
    }
    xWalkWebView.addJavascriptInterface(new JSBridge(), "Android");
}

How can I find an squash this dialog?

0

There are 0 answers