Skip to content

WebView settings #6

@vovanb

Description

@vovanb

I try to run inside of MAUI WebView existing portal based on AngularJS which is working fine in default browser. It is failing due to rendering issues. I found recommendation in https://stackoverflow.com/questions/35443149/issues-in-loading-angular-js-website-in-android-webview to enable HTML5. I tried to do it in your HybridWebViewHandler.cs as below:

 protected override Android.Webkit.WebView CreatePlatformView()

   {
            sync = sync ?? SynchronizationContext.Current;

            var webView = new Android.Webkit.WebView(Context);
            jsBridgeHandler = new JSBridge(this);

            //enable HTML5
            webView.Settings.JavaScriptEnabled = true;
          
            webView.Settings.AllowFileAccess = true;
            webView.Settings.SetSupportMultipleWindows(true);
            webView.Settings.DatabaseEnabled = true;
            webView.Settings.DatabasePath = "/data/data/" + "/databases/";

            webView.Settings.DomStorageEnabled = true;
            webView.Settings.SetAppCacheEnabled(true);
            webView.Settings.SetAppCacheMaxSize(1024 * 1024 * 8);
            webView.Settings.SetAppCachePath("/data/data/cache/");
            webView.ClearCache(true);

           //end of enable HTML5
            webView.SetWebViewClient(new JavascriptWebViewClient($"javascript: {JavascriptFunction}"));
            webView.AddJavascriptInterface(jsBridgeHandler, "jsBridge");

            return webView;
        }

But it did not help... Is it right place to add? What I am missing and what can be improved?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions