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

  • SEARCH
  • Home
  • 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 7742893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:23:36+00:00 2026-06-01T09:23:36+00:00

Hi i am loading local html file after handling some javascript alerts on webchromeclient,

  • 0

Hi i am loading local html file after handling some javascript alerts on webchromeclient,
But after i call webview’s loadUrl method my local html page loads very slowly it waits about 20 seconds to load.

Here is my code below:

@Override
    public boolean onJsAlert(WebView view, String url, String message,
            JsResult result) {
        // TODO Auto-generated method stub

        result.confirm();

        if (message.contains(GeneralConstants.ALERT_LOGIN_TIMUSER)) {
            String s[] = message.split(";");

            //Set ldap user 


            view.loadUrl("file:///android_asset/mainMenu.html");

            return true;
        }

Thanks for any advice.

  • 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-01T09:23:37+00:00Added an answer on June 1, 2026 at 9:23 am

    try this piece of code for a better performance

        AssetManager mgr = getContext().getAssets();
                     try {
                         InputStream in = mgr.open(FileName,AssetManager.ACCESS_BUFFER);
    
                         String sHTML = streamToString(in);
                         in.close();
    
                         //display this html in the browser
                         WebView w = (WebView) findViewById(R.id.webview);
                         w.getSettings().setDefaultZoom(ZoomDensity.FAR);
                         w.loadDataWithBaseURL("file:///android_asset/", sHTML, "text/html", "utf-8", null);                        
    
                     } catch (IOException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                     }
    
    
    
    public static String StreamToString(InputStream in) throws IOException {
            if(in == null) {
                return "";
            }
    
            Writer writer = new StringWriter();
            char[] buffer = new char[1024];
    
            try {
                Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
    
                int n;
                while ((n = reader.read(buffer)) != -1) {
                    writer.write(buffer, 0, n);
                }
    
            } finally {
    
            }
    
            return writer.toString();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call a javascript function from loaded local html file in
I have local html file under my assets folder. I am loading this file
I am loading a local HTML file into a UIWebView in iOS using this
I want to download a page and show this in WEBVIEW local, but the
I'm having trouble loading a local French / Spanish HTML within Windows Phone 7.
I'm loading local .html files into a UIWebView, then if the user clicks on
I have an HTML file that I am loading into a JTextPane which contains
I have created a HTML file to load local XML file and read contents
I have a pageTest.html in local folder,this page call a service.ashx?i=...(that return value param
After loading a PHP template (using jQuery's load function), this simple script won't make

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.