Android WebView -> Display WebArchive

后端 未结 2 811
感动是毒
感动是毒 2020-12-01 12:49

Android\'s WebView has this saveWebArchive method since API level 11: http://developer.android.com/.

It can save entire websites as webarchives, which is great! But

2条回答
  •  感情败类
    2020-12-01 13:11

    I've found an undocumented way of reading saved webarchive. Just do:

    String raw_data = (read the mywebarchivefile as a string)
    

    and then call

    webview.loadDataWithBaseURL(mywebarchivefile, raw_data, "application/x-webarchive-xml", "UTF-8", null);
    

    The reference: http://androidxref.com/4.0.4/xref/external/webkit/Source/WebCore/loader/archive/ArchiveFactory.cpp

    Available from Android 3.0, api level 11.

提交回复
热议问题