enable javascript in webview
This commit is contained in:
parent
1a1b53aaa6
commit
033219169b
1 changed files with 4 additions and 1 deletions
|
@ -20,8 +20,11 @@ public class ExampleApp extends Activity {
|
|||
WebView myWebView = new WebView(this);//activityContext);
|
||||
WebViewClient myWebViewClient= new WebViewClient();
|
||||
myWebView.setWebViewClient(myWebViewClient);
|
||||
String unencodedHtml = "<!DOCTYPE html><html><h1> this is html <h1> <h2> this is a h2</h2></html>";
|
||||
String unencodedHtml = "<!DOCTYPE html><html><a href='https://html5test.co/'>https://html5test.co/</a><h1> this is html <h1> <h2> this is a h2</h2><img src='https://wald.alexmahr.de/images/rabe.avif'></html>";
|
||||
String encodedHtml = Base64.encodeToString(unencodedHtml.getBytes(),Base64.NO_PADDING);
|
||||
WebSettings myWebSettings = myWebView.getSettings();
|
||||
myWebSettings.setBuiltInZoomControls(true);
|
||||
myWebSettings.setJavaScriptEnabled(true);
|
||||
myWebView.loadData(encodedHtml, "text/html", "base64");
|
||||
//myWebView.loadUrl("https://alexmahr.de/ru");
|
||||
setContentView(myWebView);
|
||||
|
|
Loading…
Add table
Reference in a new issue