Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:09:42+00:00 2026-06-04T07:09:42+00:00

My native app includes a WebView, and the WebView loads a web page off

  • 0

My native app includes a WebView, and the WebView loads a web page off web. For example, the html is loaded from

http://dongshengcn.com/test.html

It seems any page loaded from web (instead of local) can not load any file from local device.

My question is:

Is it possible for a http://dongsheng.com/test.html loaded to a webview (as part of native app) to access file on local device?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:09:43+00:00Added an answer on June 4, 2026 at 7:09 am

    Here are a couple of things to try:

    1. To use local files you need to place them in your project’s assets folder and invoke them using URLs such as file:///android_asset/. For example, if you add mypage.html in your assets folder, then you can invoke it in the webview with file:///android_asset/mypage.html.

    2. Check to make sure that you have the appropriate webview permissions in your Manifest. For the webview to work correctly, you need:

      <uses-permission android:name="android.permission.INTERNET" />

    3. Take a look at the following app on Github, which as a bonus also fixes a couple of bugs with the webview in Honeycomb and ICS. It is a full example on how to use the webview with local files:
      https://github.com/bricolsoftconsulting/WebViewIssue17535FixDemo

    EDIT: Addendum after question clarification:

    Yes, it is possible to load a local page from the web, but you must use a trick to bypass the browser’s security measures.

    Replace the file://android_asset/ portion of the URLs with a custom scheme (e.g. file///android_asset/mypage.html becomes myscheme:///mypage.html), and place these custom scheme URLs in your page. Implement WebViewClient’s shouldOverrideUrlLoading, check if the URL begins with the custom scheme and if so redirect to the local page using webview.loadUrl.

        mWebView.setWebViewClient(new WebViewClient()  
        {  
            @Override  
            public boolean shouldOverrideUrlLoading(WebView view, String url)  
            {  
                if (url != null && url.startsWith("myscheme://"))  
                {  
                    String newUrl = url.replace("myscheme://", "file://android_asset/");  
                    mWebView.loadUrl(newUrl);  
                    return true;  
                }  
                return false;  
            }  
        }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I'm working on an HTML-based web app (i.e., not native app) targeted for
I've got a native Android app that contains a WebView. All my HTML, js
I created a native Android app that basically hosts a webView control. That webView
This isn't a native iPad app. This is a HTML5 web app which runs
I want to identify the an android native app user on my web service.
Am looking into developing an iPhone native app using Titanium Developer Since this is
I need to develop a native app both on iOS and Android. It is
I've inherited a small project. The person before me created a native app for
I am developing native iPhone app. I have one requirement that, there are 5
I have native facebook app in development for few months and login worked on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.