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 9117487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:54:24+00:00 2026-06-17T04:54:24+00:00

I am using Android WebView to load some webpages. In my case, I have

  • 0

I am using Android WebView to load some webpages. In my case, I have to insert some JavaScript codes before loaded webpages. Just like below:

//enable javascript
mWebView.getSettings().setJavaScriptEnabled(true);

//inject my js first. 
//I can't inject the js onPageStarted() or onPageFinished() because I need to make  sure the js
//is injected before html loaded.
mWebView.loadUrl("javascript:MyJsCode"); 

//load HTML      
mWebView.loadUrl("http://example.com/demos/index.html");

The code works fine first time, but failed when run it more than one time. Because the HTML can’t find my JS.

I think because the previous HTML is not clear completely, so mWebView.loadUrl("javascript:MyJsCode") inject MyJsCode to previous HTML instead of the new HTML.

So I thought if I could completely reset the WebView(to clear the previous HTML), will solve my issue.

I tried WebView.ClearView(), loadUrl("about:blank"), they all doesn’t work.

Anyone suggestion?

  • 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-17T04:54:26+00:00Added an answer on June 17, 2026 at 4:54 am

    I think there is no way to do this except re-new a WebView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android Webview where I load HTML into using loadDataWithBaseURL, some of
I am using webview in my android app to fetch some webpages from multiple
I am using a Webview and some css3 to load an image and have
I have an Android app using webview to load and display html pages. But
I have just started using android, and have about 5 layout files finished. However,
I want to load youtube video to Android webview using iframe here is my
I'm working on an android native application, and I'm using a Webview to load
I know how to load site's content in Android using WebView (webview.loadUrl(http://slashdot.org/);) And how
I am working in Android with WebView that load javascript. I've succeeded to load
I'm developing a browser-like application in android using WebView. While loading the URL, I

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.