Git Product home page Git Product logo

Comments (3)

gabn88 avatar gabn88 commented on July 17, 2024

Can anyone point me if I'm on the right track?

In handleNetworkConnectionChange in cordova-plugin-hostedwebapp\src\android\HostedWebApp.java change

  if (this.isConnectionError) {
    this.activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            String currentUrl = me.webView.getUrl();
            me.webView.loadUrlIntoView(currentUrl, false);
        }
    });

to:

  if (this.isConnectionError) {
    this.activity.runOnUiThread(new Runnable() {
        // try reload the start page every 5 minutes
       }
    }); 

( I only need Android)

from manifoldcordova.

boyofgreen avatar boyofgreen commented on July 17, 2024

Thanks for the post! If I understand correctly, you don't want to show the offline page, you just want cancel the navigation and stay on the page until your online?

from manifoldcordova.

gabn88 avatar gabn88 commented on July 17, 2024

Thank you @boyofgreen for your response.

First, HTTP 5xx responses do not show the offline page. The offline page is for when the device itself is offline (and maybe when a page cannot be reached at all? I should check this to be sure).

Also this issue is not related with the offline page issue/enhancement and for me this issue has higher priority.

The issue is that I have (Android) devices that continually show some webpage. And people using those devices do all kinds of things on that webpage, among which refresh/navigate. But if, at the same moment that they navigate/refresh, I do a server update that fails (I know it should never happen, but...) and my server responses with a HTTP 500 page or maybe a HTTP 502 gateway error or even a HTTP 504 Gateway Timeout, they people are stuck with a page that shows the error.

Because I have hidden the navigation bar, those people have no other option then to restart the device, which is lame. I don't want to show the navigation bar, because I like the extra space on the displays and the navigation bar is also not needed.

By catching the 5xx responses, it would be possible to automatically to retry to load the page, or maybe go to the start_page. (whichever is easier to implement is fine with me) and keep doing this every X minutes untill the page has loaded correctly.

EDIT: Maybe it helps to say that I use the crosswalk plugin. I think it might change the behaviour of the loadUrl function.

from manifoldcordova.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.