Bug 28901 - WebView not allowing DOM Storage
Summary: WebView not allowing DOM Storage
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.2
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2015-04-08 17:10 UTC by Mobiledev
Modified: 2015-06-25 11:05 UTC (History)
3 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Mobiledev 2015-04-08 17:10:01 UTC
The default WebView Renderer does not enable DomStorage by default or offer the options to from the forms project.  Currently a custom renderer must be implemented, the code to do so is below:

public class FormsWebViewCustomRenderer : WebViewRenderer
{
    protected override void OnElementChanged (ElementChangedEventArgs<Xamarin.Forms.WebView> e)
    {
        base.OnElementChanged (e);

        var formsWebView = e.NewElement as Xamarin.Forms.WebView;

        if (formsWebView != null) {
            var nativeWebView = Control as Android.Webkit.WebView;
            nativeWebView.Settings.JavaScriptEnabled = true;
            nativeWebView.Settings.DomStorageEnabled = true;
            nativeWebView.LoadUrl ("Your URL here");
        }
    }
}
Comment 1 Rui Marinho 2015-06-03 12:49:59 UTC
Should be fixed in 1.4.3 final
Comment 3 Mobiledev 2015-06-16 11:16:42 UTC
Parmendra Kumar, Rui Marinho commented that this should be fixed in 1.4.3 final, so do you still need steps and a sample project.  If you refer to my correspondence with your technical support team, you'll find that they were able to reproduce it, and gave me the work-around of a custom renderer, and I believe they are incorporating the work-around into the 1.4.3 build.