question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Vaadin 19] Custom offline page is not used when navigating to Java views

See original GitHub issue

Description of the bug / feature

I’ve prepared my custom offline.html page. I’ve put it in 3 places in my project (java + spring app on Vaadin 19):

  1. src/main/resources/META-INF/resources/ (according to https://vaadin.com/docs-beta/latest/guide/configuration/pwa/#offlinePath)
  2. even in src/main/webapp/ (because the above didn’t work)
  3. even in frontend/ (where index.html resides successfully)

Of course I have this @PWA(... , offlinePath = "offline.html") in my AppShellConfigurator class.

But when I’m testing offline mode (Chrome / Network / Offline ) my custom offline.html page is not show only Vaadin default one is shown: image

Expected behavior

I want my custom offline page to be shown. Is this a bug or I’m doing something wrong?

Versions:

- Vaadin / Flow version: Vaadin 19.0.0.beta4
- Java version: 8
- OS version: Win10
- Browser version (if applicable): Chrome

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
joherikscommented, Mar 4, 2022

Decided on a solution were the custom offline page is used in both cases (stand-alone and embedded in the app shell protected by an <iframe>). So the behavior will be:

Offline start:

  • offlinePath=custom.html: render custom.html as a single page in browser
  • No custom offlinePath set: render app shell with the Flow default offline page in iframe

Offline navigation:

  • offlinePath=custom.html: render appshell with custom.html embedded in iframe
  • no custom offlinePath set: render appshell with the Flow default offline page in iframe

Currently blocked by vaadin/flow#10031

1reaction
darmrocommented, Mar 11, 2021

Hi @Haprog I have only java views (no TS, so far). Plus static html page (static and closed - I mean seperated from views, theme, styles) called offline.html. I thought that if I give it to offlinePath my static html page is shown, but no, only vaadin default page is shown, moreover in English of course- it is a problem, cause it should be in Polish 😃
If it was possible to parametrize this default offline page and give your texts it wolud be enough. For example via CustomizedSystemMessages, where I can set my texts for eg. session expiration, or in the same way as I configure reconnect text (via dedicated ReconnectDialogConfiguration class).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fusion: Customizable offline stub for Java views · Issue #277
The user gets the stub when trying to navigate a Java view when offline. It's nice but it has limitations that it's not...
Read more >
Recommended Changes | Upgrading | Vaadin Docs
The PageConfigurator interface is deprecated; customize initial page settings instead by overriding AppShellConfigurator::configurePage() .
Read more >
PWA Offline Page | Progressive Web Applications - Vaadin
This is a simple page that: Includes the application name and icon. Communicates to the user that the application is offline, because there...
Read more >
Vaadin 19 adds offline functionality to Fusion: here's how it ...
Once the application shell and route JavaScript bundles are cached, users can navigate between views in the app offline as well as online....
Read more >
App Layout | Components | Vaadin Docs
The layout consists of three sections: a horizontal navigation bar (navbar), a collapsible navigation drawer (drawer) and a content area.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found