HTML 5 - Testing the offline cache with localhost

My HTML 5 application is deployed locally on Tomcat, how can I check offline access?

Here is a detailed description:

I have a very simple JSP application in which I try to test the standalone HTML 5 cache.

Here's what my JSP page (code snippet) looks like:

<!doctype html> <html lang="en" manifest="example.appcache"> 

And this is the manifest file:

 # Resources that require the user to be online. NETWORK: /jsp/date.jsp FALLBACK: /jsp/date.jsp /jsp/staticDate.html 

The application is deployed on Tomcat 6. I can very well access the date.jsp page when Tomcat is running, and I see an FF popup asking me for permission to store data locally. How can I check access to a page offline? I stopped Tomcat, but I see a standard page with a browser error (it is not possible to connect an error message).

Thanks JJ

+4
source share
2 answers

staticDate.html also served by Tomcat. Therefore, you need Tomcat to work, but after the browser caches the website, disable the servlet for date.jsp .

0
source

You are doing it wrong. HTML5 offline means that the connection to is unavailable, and not when the server is turned off. If you have an Internet connection on your computer, it will try to get to the server, find out that Tomcat is not working, and return a 404 or 503 error.

If your Internet connection to the computer does not work, the browser must acknowledge that you do not have an Internet connection, and then try to back up.

It also assumes that you have encoded everything correctly and are using the HTML5 browser.

To test, I would suggest disconnecting the PC / Mac Internet connection.

-2
source

Source: https://habr.com/ru/post/1402014/


All Articles