Android Question [SOLVED] WebViewExtras lib

Discussion in 'Android Questions' started by Lello1964, May 29, 2019.

  1. Lello1964

    Lello1964 Active Member Licensed User

    Hello,
    i'm tryning to open xml file with xls scheme using WebViewExtras lib,
    this my code :
    Code:
    Sub Globals
        
    Dim WebView1 As WebView
       
    Dim WebViewExtras1 As WebViewExtras
       
    Dim WebViewSetting As WebViewSettings
       
    Dim DBFileDir As String                   : DBFileDir =RP1.GetSafeDirDefaultExternal("")
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
       WebView1.Initialize(
    "WebView1")
      
       WebViewExtras1.addWebChromeClient(WebView1, 
    "")
       
    Activity.AddView(WebView1, 00100%x100%y)
      
       
    Dim url="file:///" & File.Combine(DBFileDir, "IT00430310672_0001N.xml")
       
    Log("Loading " & url)
       WebView1.LoadUrl(url)
      
    End Sub
    [code/]

    both 
    file xls and xlm are ... /Android/data/xmkl.test/files/

    i have this error :

    Logger connesso a:  Xiaomi Redmi Note 
    3
    --------- beginning of system
    --------- beginning of main
    ** 
    Service (starter) Start **
    ** 
    Activity (main) Create, isFirst = true **
    Loading 
    file:////storage/emulated/0/Android/data/xmkl.test/files/IT00430310672_0001N.xml
    Unsafe attempt 
    to load URL file:///storage/emulated/0/Android/data/xmkl.test/files/fatturapa_v1.2.xsl from frame with URL file:///storage/emulated/0/Android/data/xmkl.test/files/IT00430310672_0001N.xml. 'file:' URLs are treated as unique security origins.
     in file:///storage/emulated/0/Android/data/xmkl.test/files/IT00430310672_0001N.xml (Line: 2)
    ** 
    Activity (main) Resume **

    how can i solve ?
     
  2. Lello1964

    Lello1964 Active Member Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    Try to load it from File.DirInternal.
     
  4. Lello1964

    Lello1964 Active Member Licensed User

    Erel, thanks for answare, but i have tryed to open XML files using File Manager with default Smartphone browser and i have some blank image.
    If i use Mozilla to open XML i will see XML with XSL format correct.
    I think cannot solve this problem.
     
  5. Lello1964

    Lello1964 Active Member Licensed User

    [SOLVED]
    Code:
    Dim jo As JavaObject = WebView1
       
    Dim settings As JavaObject = jo.RunMethod("getSettings"Null)
       
    Dim r As Reflector
       r.Target = 
    settings
       r.RunMethod2(
    "setAllowUniversalAccessFromFileURLs"True"java.lang.boolean")
     
    Star-Dust likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice