Bug 22671

Summary: Warn the user in offline circulation if applicationCache isn't supported
Product: Koha Reporter: Pierre-Marc Thibault <pierre-marc.thibault>
Component: Browser compatibilityAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, david, felicia.beaudry, gmcharlt, jonathan.druart+koha, josef.moravec, katrin.fischer, kyle.m.hall, kyle, magnus, martin.renvoize, nugged, philippe.audet-fortin, victor
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29255
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.03,21.05.13
Bug Depends on: 29255    
Bug Blocks:    
Attachments: Bug 22671: Show warning if browser doesn't support applicationCache
Bug 22671: Show warning if browser doesn't support applicationCache
Bug 22671: Show warning if browser doesn't support applicationCache

Description Pierre-Marc Thibault 2019-04-09 12:21:03 UTC
I am not able to use the feature on master when I follow these steps :

1) I set AllowOfflineCirculation to Enable.
2) I go to Circulation > Built-in offline circulation interface > Synchronize.
3) I click on "Download records" and dates appear like this : "2019-04-08 16:39:16 GMT-0400 (Eastern Daylight Time)".
4) I disable my internet connection.
5) I go to "https://your-koha-staff-client-url/cgi-bin/koha/circ/offline.pl".
6) I get a 404 page.

It's likely the technology is no longer supported as windows.applicationCache is deprecated and cannot be used in a not secure context (http). I am not really sure if the problem comes from my koha or that, so I am asking the community if this feature still works.

I tested an updated master in https on Firefox 66.0.2.

Thank you for your feedbacks.
Comment 1 Katrin Fischer 2020-01-03 07:08:36 UTC
I can't replicate this. I am testing with current master in Firefox on Ubuntu without problems.
Comment 2 Felicia Beaudry 2020-04-14 13:53:30 UTC
We are seeing similar issues on training servers and client production servers also.  The built-in offline circ tool will not work without logging in.

In my case, I download records for offline storage, and receive errors that the patron barcode is not found.  I have confirmed that the barcode is correct and is being scanned/entered correctly. Seeing the same behavior on both Firefox and Chrome.
Comment 3 Owen Leonard 2021-10-15 18:47:08 UTC
The offline circulation tool depends on a browser feature which is obsolete: applicationCache. It has been removed from the latest version of Chrome (94) and recent versions of Firefox (since version 81).

Since the feature can still be used by some users if they have older browsers we can't remove it entirely. While we wait for a more broadly-compatible solution we should hide the feature in browsers which don't support it.
Comment 4 Owen Leonard 2021-10-18 12:36:59 UTC
Created attachment 126433 [details] [review]
Bug 22671: Show warning if browser doesn't support applicationCache

This patch adds a check for browser support for the "applicationCache"
feature required by the offline circulation tool. If the feature is not
available, a message is shown to the user that offline circulation is
disabled.

To test, apply the patch and enable the AllowOfflineCirculation system
preference.

In a browser which supports applicationCache (Firefox < 81, Chrome < 94,
Safari <= 15), go to Circulation -> Built-in offline circulation
interface.

- You should see the standard Offline Circulation menu options: Check
  out, check in, syncrhonize, etc.
- Click "Synchronize," then "Download records."
- The process should complete correctly, updating the "last synced"
  information on the page.

Follow the same steps in a browser which has dropped support for
applicationCache. As soon as you reach the built-in offline circulation
page you should see a message, "Your browser is not compatible..."
Comment 5 Owen Leonard 2021-10-26 13:50:48 UTC
(In reply to Owen Leonard from comment #4)
> In a browser which supports applicationCache (Firefox < 81...

MDN says "Warning: Application Cache is deprecated as of Firefox 44, and is no longer available in insecure contexts from Firefox 60 onwards." It's working for me now in Firefox 93 FWIW.
Comment 6 David Nind 2021-10-30 04:22:12 UTC
I tried to test, but didn't have much luck getting the in-built offline circulation tool to work.

With the latest version of Firefox (93) + Firefox developer edition on Ubuntu 18.04: doesn't show the your browser is not supported message, when you go into synchronise > download is has a message "Downloading ..." and stays there with a progress icon.

I couldn't work out how to install an earlier version of Firefox or Chromium browsers to test.

For the latest versions of Google Chrome + Chromium the browser not supported message is shown.
Comment 7 David Nind 2021-10-30 04:32:14 UTC
Replying to myself, now realising it probably isn't working because KTD is in strict SQL mode...
Comment 8 Martin Renvoize 2022-01-31 09:48:44 UTC
Created attachment 129987 [details] [review]
Bug 22671: Show warning if browser doesn't support applicationCache

This patch adds a check for browser support for the "applicationCache"
feature required by the offline circulation tool. If the feature is not
available, a message is shown to the user that offline circulation is
disabled.

To test, apply the patch and enable the AllowOfflineCirculation system
preference.

In a browser which supports applicationCache (Firefox < 81, Chrome < 94,
Safari <= 15), go to Circulation -> Built-in offline circulation
interface.

- You should see the standard Offline Circulation menu options: Check
  out, check in, syncrhonize, etc.
- Click "Synchronize," then "Download records."
- The process should complete correctly, updating the "last synced"
  information on the page.

Follow the same steps in a browser which has dropped support for
applicationCache. As soon as you reach the built-in offline circulation
page you should see a message, "Your browser is not compatible..."

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2022-01-31 09:49:08 UTC
Works as expected for me.. signing off.
Comment 10 Jonathan Druart 2022-02-18 09:35:29 UTC
Created attachment 130814 [details] [review]
Bug 22671: Show warning if browser doesn't support applicationCache

This patch adds a check for browser support for the "applicationCache"
feature required by the offline circulation tool. If the feature is not
available, a message is shown to the user that offline circulation is
disabled.

To test, apply the patch and enable the AllowOfflineCirculation system
preference.

In a browser which supports applicationCache (Firefox < 81, Chrome < 94,
Safari <= 15), go to Circulation -> Built-in offline circulation
interface.

- You should see the standard Offline Circulation menu options: Check
  out, check in, syncrhonize, etc.
- Click "Synchronize," then "Download records."
- The process should complete correctly, updating the "last synced"
  information on the page.

Follow the same steps in a browser which has dropped support for
applicationCache. As soon as you reach the built-in offline circulation
page you should see a message, "Your browser is not compatible..."

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2022-02-18 09:35:52 UTC
Lazy to install an old browser, trusting author and tester.

Warning display on an up-to-date FF.

We could have added a link to https://developer.mozilla.org/docs/Web/API/Window/applicationCache to list the compatibility.
Comment 12 Fridolin Somers 2022-02-22 01:13:51 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 13 Kyle M Hall 2022-02-25 13:21:58 UTC
Pushed to 21.11.x for 21.11.03
Comment 14 Andrew Fuerste-Henry 2022-03-07 20:33:16 UTC
Pushed to 21.05.x for 21.05.12
Comment 15 Victor Grousset/tuxayo 2022-03-18 02:38:34 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.