开发者

Problem with HTML5 offline in mobile web app

I can't get offline mode in iphone mobile Safari to work.

I have included my cache manifest file in the root of my directory.

 <html lang="se" manifest="cache.manif开发者_StackOverflow中文版est">

My cache.manifest looks like

  CACHE MANIFEST 

  CACHE:
  /images/background-iphonelines.png
  /images/acne.jpg
 /images/lisa.jpg
 /images/bruno.jpg
 /images/urban.jpg
 /shops/acne.html
 /shops/lisa.html
 /shops/bruno.html
 /shops/urban.html
 /shops/shops.css
  /style.css
  script.js
  guide.html

  NETWORK:
  *

I also included a .htaccess file in my root directory with the content

  AddType text/cache-manifest .manifest

When I'm trying to open my app on my Iphone it still says "Can't open page" (or similar, have my page in swedish).

Does someone have any suggestions what I'm doing wrong?


Your mark-up and cache file look fine, but if the site won't go off-line there's a problem with the cache. It only has to fail on one element, and the whole thing won't work. Have you tried debugging your cache file? This post will help:

Jonathan Stark, Debugging HTML 5 Offline Application Cache

Note this won't tell you which asset causes the failure (if any), but it will tell you if your cache is working or not.


I actually had a similar issue yesterday. Try removing the CACHE: and just listing the items for the cache. I found this by accident and it seems to now work on IOS for me. Also, I added a comment field at the top to make sure I can invalidate the cache. I would give that a try.


I also had the same problem. I included the lines below in the cache.manifest file & it fixed for me.

NETWORK:

*


I was struggling for 2 hours with this and finally I've managed it! HORAY! I've added "/" to cache, this was the problem...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜