Android webview loadurl(“file:///android_asset/index.html#home”) failed

前端 未结 2 2249
执笔经年
执笔经年 2020-12-07 01:10

I am working on an application in Android, where I want to load a local html file using

webview.loadurl(\"file:///android_asset/index.html#home\");
<         


        
相关标签:
2条回答
  • 2020-12-07 01:58

    First check that index.html is under asset folder in your project folder.

    I believe it is under www folder within asset folder of your project.

    1:First put index.html under www folder

    2:put the www folder within asset folder and call

    webview.loadurl("file:///android_asset/www/index.html");
    

    Edited:

    I think you might want to call the home tab of the index.html every-time when you will run the application.

    As android is only concern of the html pages not the tabs here is a good way which may help you i.e.

    Set the home tab active of your index.html and make other inactive.

    This will might help you.

    0 讨论(0)
  • 2020-12-07 01:59

    this is what happen to me i misspelled it make sure you typed correctly

    file://android_asset/www/index.html

    not as "assets"

    0 讨论(0)
提交回复
热议问题