Search code examples
htmlcache-manifest

HTML5 Manifest fallback URL


I have a website which in a DEV context has the URL localhost:8080/MySite and on test/live it will just be www.test.mysite.com and www.mysite.com

In my manifest i have

FALLBACK:
/ offline.html

the problem is if the user hits localhost:8080/MySite (not no slash on end) and the fallback kicks in they get redirected to localhost:8080MySite which bugs...

Does anyone know around this issue, I tried / /offline.html but that bugged the manifest


Solution

  • I tried to replicate your case as much as I could. It worked fine for me using the following:

    • I have a directory structure like this one:

      /MySite/HTML/

      /MySite/Styles/

      /MySite/Images/

      /MySite/Scripts/

    All my HTML files are located under /MySite/HTML/, including "offline.htm"

    • My manifest file is as follows:

      CACHE MANIFEST

      CACHE: main.htm

      /MySite/Styles/mustyles.css

      /MySite/Images/random.jpg

      /MySite/Scripts/jquery.js

      NETWORK:

      *

      FALLBACK:

      / /MySite/HTML/offline.htm

    If I type the Following URLs, I always get the "offline.htm" page:

    • localhost/MySite/
    • localhost/MySite
    • localhost/MySite/HTML/
    • localhost/MySite/HTML

    Note the fallback URL. Tested on FF and Chrome.

    Hope this helps.