Submitting an HTML form using WebView for Android

I'm a little new to Android, and I had a problem submitting an HTML form using WebView.

I am trying to upload a video to YouTube (I know that it is illegal! I do it for the sake of practice) by entering the URL of the video in the form of an existing website.

I also need to press the submit button.

Below is my code that seems to do nothing.

    String javascript = "javascript: {"
        + "document.getElementById('aurl').value = " + videoUrl + ";"
        + "var button = document.getElementsByName('asubmit');"
        + "button.click(); }";
    webView.loadUrl(javascript);
+4
source share
1 answer

WebView iFrame, URL- . , , . String loadUrl (...) URL- , .

, Javascript -, :

WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
+1

All Articles