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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:20:13+00:00 2026-05-24T06:20:13+00:00

I have javascript in a webview that only loads sometimes. Other times it doesn’t,

  • 0

I have javascript in a webview that only loads sometimes. Other times it doesn’t, this effects my page layout and functionality.

the obvious answer myWebView.getSettings().setJavaScriptEnabled(true); is already being used before my loadurl function

right now, both the html file and the jquery library file are being loaded from the assets folder. In the HTML code I am using <script type="text/javascript" src="jquery.min.js"></script> to load the jquery file locally

On the Java side within my onCreate() method:

 myWebView.getSettings().setJavaScriptEnabled(true);
 myWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
 myWebView.loadUrl("file:///android_asset/newtry.html");

The HTML file
<html>
<head>
<script type="text/javascript" src="jquery.min.js"></script>
<script> //the custom jquery functions, no more includes </script>
<style type="text/css">
//the css
</style>
</head>
<body>

these files – the HTML and the jquery.min.js are in the same folder assets

what else can I do?

  • 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-05-24T06:20:14+00:00Added an answer on May 24, 2026 at 6:20 am

    The answer is that you have to force the app to wait (try it, place a breakpoint at your webview, and then let it continue, you’ll see the webview will load with javascript this time, reliably. Whereas if you just let the app load without the breakpoint, it frequently “skips” the javascript). Some sort of forced threaded wait method is needed.

    A second method is to force the javascript to load after the page is loaded, as shown by the author’s answer here android: webview not loading javascript with custom WebViewClient

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

Sidebar

Related Questions

I have WebView which loads some page, when it's finished I apply some javascript
On Android, I have a WebView that is displaying a page. How do I
I have an iPad app that contains a webview. The webview's page has a
I have a Javascript object that (very simplified) looks like this if('undefined' !== typeof(listCtrls)){
I have this javascript code that creates a slider: http://jsfiddle.net/samccone/ZMkkd/ Now, i want to
I have a JavaScript method that I need to run on one of my
I have a javascript function that manipulates the DOM when it is called (adds
I have a JavaScript resource that has the possibility of being edited at any
I have a JavaScript snippet that runs very well on Firefox and Safari, but
I have a JavaScript function, pop_item . I have to call this from PHP,

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.