thobens
thobens

Reputation: 1731

AppCache and pushState

For my mobile application I want to use pushState and AppCache, but this seems to be tricky.

To make pushState work, my web server redirects every url (except assets like the manifest file itself, images, css- and js files) to /index.html internally.

E.g. a request to /articles/123 will redirect to / respectively /index.html (so the originally requested URL is still visible in the browser).

This causes the request to the manifest.appcache to a wrong path, like /articles/123/manifest.appcache instead of /manifest.appcache, which leads us to the problem that the browser creates a new cache group for every directly accessed URL (e.g. by a Google search)

I redirect (.*)/manifest\\.appcache to /manifest.appcache and it is interpreted, so that should work as expected. I think the main issue is that the browser treats the manifest.appcache file on URL level instead of domain level.

So this leads me to the following questions:

  1. Is this a practicable approach?

  2. If yes, can I tell the browser to use the AppCache on domain level and how?

  3. If no, what am I not thinking through?

Upvotes: 2

Views: 298

Answers (1)

idbehold
idbehold

Reputation: 17168

When you put the manifest attribute on the <HTML> element just set the path properly to point to the root directory:

<html manifest="/appcache.manifest">

Upvotes: 2

Related Questions