Android Question [RESOLVED] WebviewExtras2 - Uncaught Error: Local storage access is not allowed

MarcoRome

Expert
Licensed User
Longtime User
Hi all i utilize WebViewExtra2, i have this code:

B4X:
Sub Globals
    Dim LogonUrl As String="http://www.cxxxx.it/pagina-xxxx-tl/"
    Dim WebView1 As WebView
    Dim WebViewExtras1 As WebViewExtras
End Sub

Sub Activity_Create(FirstTime As Boolean)
    WebView1.Initialize("WebView1")
    Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
    WebViewExtras1.Initialize(WebView1)
    Dim WebChromeClient1 As DefaultWebChromeClient
    WebChromeClient1.Initialize("WebChromeClient1")
    WebViewExtras1.SetWebChromeClient(WebChromeClient1)
    WebView1.LoadUrl(LogonUrl)
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub WebChromeClient1_ConsoleMessage(ConsoleMessage1 As ConsoleMessage) As Boolean
    Log("WebChromeClient1_ConsoleMessage")
    Log(ConsoleMessage1.Message)
End Sub

Sub WebView1_PageFinished (Url As String)
    Log("WebView1_PageFinished")
    If Url=LogonUrl Then
             Dim Javascript As StringBuilder
            Javascript.Initialize
            Javascript.Append("var form=document.forms[0];")   '   this assumes your form is the first form on the page
            Javascript.Append("form.log.value='xxxx';")
            Javascript.Append("form.pwd.value='yyyyy';")
            Javascript.Append("form.submit()")
            Log("Executing javascript: "&Javascript.ToString)
        '    uncomment next line to auto submit the logon form
        '    be careful - if logon fails then the webpage will be reloaded
        '    and an infinite loop of failed logons is likely
        '    Javascript.Append("document.forms.fSSUser_Logon.submit();")
        WebViewExtras1.ExecuteJavascript(Javascript.ToString)
        Log("Form updated")
    End If
End Sub


I add also in manifest this lines:
B4X:
AddPermission(android.permission.WRITE_MEDIA_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)


and return this error:
Uncaught Error: Local storage access is not allowed. This is a problem with some browsers running private windows.

Any idea ?
Thanks
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
Resolved. The code and library work without problem. The problem is KitKat ( same problem with webview and webviewExtra2 ).
I upgraded my device Lollipop and i havent problems.
Look HERE
 
Upvote 0
Top