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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:35:07+00:00 2026-06-15T17:35:07+00:00

I have the following code in my activity: browser = (WebView)findViewById(R.id.webkit); browser.getSettings().setJavaScriptEnabled(true); browser.getSettings().setPluginsEnabled(true); browser.getSettings().setDomStorageEnabled(true);

  • 0

I have the following code in my activity:

    browser = (WebView)findViewById(R.id.webkit);
    browser.getSettings().setJavaScriptEnabled(true);
    browser.getSettings().setPluginsEnabled(true);
    browser.getSettings().setDomStorageEnabled(true);

    /*if (Build.VERSION.SDK_INT >= 16) {
        browser.getSettings().setAllowFileAccessFromFileURLs(true);
        browser.getSettings().setAllowUniversalAccessFromFileURLs(true);
    }*/

    // Loads html-string into webview
    browser.loadUrl("file:///android_asset/index.html");

THe page loads fine, the css loads fine, the images all load fine. However I also have a local js file. WHich currently only contains an alert message alert("JSEnabled"); and yet the alert never appears. How can I go about diagnosing this?

I’m currently using the emulator to develop the project and have to support back to Gingerbread (2.3.3).

Incidently the same html / js works fine when I use the Browser app on the emulator (Pointing at a remotely served version of the same HTML / js)

I should also point out – all the files are in the assets folder in the project, and I’ve tried referencing the js as file:///android_assets/main.js and as main.js. I’ve even tried referencing the remote js file. Nothing works…

  • 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-15T17:35:07+00:00Added an answer on June 15, 2026 at 5:35 pm

    To work your javascript alert please add this to your webview

      webview.setWebChromeClient(new WebChromeClient() {
    
            @Override
            public boolean onJsAlert(WebView view, String url, String message,
                    JsResult result) {
    
                return super.onJsAlert(view, url, message, result);
            }
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code: public class reader extends Activity { WebView mWebView; String mFilename;
Within one Activity I have th following piece of code: public void onStartMonitoringToggleClicked(View v)
I have the following code: /** Open a browser on the URL specified in
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
I have the following code: $query = mysql_query(SELECT * FROM activity ORDER BY activity_time
In my Activity class I have the following code after setContentView() line. gridView =
I have the following code in my user control: <asp:LinqDataSource ID=myLinqDataSource runat=server AutoSort=true ContextTypeName=MyDBContext
I have the following code in my activity: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
I have following code. public class SplashScreen extends Activity { private int _splashTime =
I have the following code: public class TestSynch extends Activity { public static ArrayList<HashMap<String,String>>

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.