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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:35:27+00:00 2026-06-09T22:35:27+00:00

I am trying to implement an error screen when a certain event is triggered

  • 0

I am trying to implement an error screen when a certain event is triggered in my js code. Since the error page is local, my attempt to set window.location.href = 'file:///android_assets/www/error.html' throws an error indicating cannot load local resource.

So I am trying to create a plugin in android and doing the following:

    public PluginResult execute(final String action, final JSONArray data, final String callBackId) {
//      final DroidGap currentCtx = (DroidGap) ctx.getContext();

        final Context currentCtx = cordova.getActivity();
        MainActivity ma = (MainActivity) currentCtx;
        ma.loadUrl("file:///android_assets/www/error.html");

        PluginResult result = null;
        return result;
    }

The problem is this code doesn’t load the URL. I am not sure if this is the right way of calling. Any insights please?

I see an error like:
08-16 01:08:48.974: I/Web Console(730): JSCallback Error: Request failed. at file:///android_asset/www/cordova-2.0.0.js:3698

  • 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-09T22:35:29+00:00Added an answer on June 9, 2026 at 10:35 pm

    It works for me when I add a public loadUrl in the MainActivity

    //MainActivity
    public void loadUrl() {
        String url = "http://google.com";
        super.loadUrl(url, 30000);
    }
    

    ….

    //Plugin
    public PluginResult execute(final String action, final JSONArray data, final String callBackId) {
    
        MainActivity ma = (MainActivity) context;
        ma.loadUrl();
    
        PluginResult result = null;
        return result;
    }
    

    I’m using PhoneGap 1.8.1 but I don’t think it matter in this case.

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

Sidebar

Related Questions

im trying to implement a custom error page, what i want to be able
I'm trying to implement a method that returns an error whenever a certain directory
I am trying to implement Error Reporting and Recovery in JavaCC grammar I have
I'm trying to implement a decorator for custom error pages in web2py as per
I've encounted an error trying to implement Apache commons-compress in my Java application: java.lang.ClassNotFoundException:
I'm trying to implement a linked list but get an error when compiling: intSLLst.cpp:38:
i receive the following error when trying to implement auto-complete based on edismax type.
I'm trying to implement this accepted solution for displaying a custom error message: https://stackoverflow.com/a/5229581/141172
I'm trying to implement my own GenericIdentity implementation but keep receiving the following error
I'm new to AS3 and I'm getting this error while trying to implement OO

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.