我試圖讓iPhone緩存一個HTML5的Web應用程序,這樣我可以在離線時使用它。網絡應用程序在www.prism.gatech.edu/~gtg880f,我沒有做到。我借用它只是爲了試用它。爲什麼我的iPhone Web應用程序沒有緩存並在離線模式下工作?
只有3個文件: 的index.html index.js 的style.css
我修改的index.html包括<html manifest="offline2.manifest">
和<meta content="yes" name="apple-mobile-web-app-capable" />
,使其看起來充滿屏幕的離線Web應用程序。
我offline2.manifest文件如下:
CACHE MANIFEST
index.html
index.js
style.css
debug.js
NETWORK:
CACHE:
PS:debug.js
是Jonathan Stark。
當我使用firefox時,它正確緩存它,並且我能夠離線使用web應用程序。但是,它在鉻和Safari瀏覽器中都失敗了。
在Chrome中,我得到了下面的調試消息:
Application Cache Checking event
Application Cache Error event: Invalid manifest mime type (text/plain) http://www.prism.gatech.edu/~gtg880f/offline2.manifest
我GOOGLE了明顯的MIME類型和它提到一些關於.htaccess
,什麼不可以,我其實也不太清楚這意味着什麼。按照說明,我去了etc/apache2/httpd.conf
並從無更改ALLOWOVERIDE ALL
。
這似乎並沒有解決任何問題,但我仍然得到相同的錯誤信息。
簡而言之,我想要做的就是使用iPhone上的Safari瀏覽器訪問www.prism.gatech.edu/~gtg880f並將其保存到我的主屏幕。然後,關閉3G和WiFi,並仍然使用網絡應用程序。
編輯:試從第一回答roryf: 仍然無法正常工作。我是否想編輯/etc/apache2/httpd.conf
中的httpd.conf
文件?我正在使用Mac OSX。我說根據本條
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /private/etc/apache2/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/cache-manifest manifest # added to allow HTML5 offline caching
還不行。 – okysabeni 2011-01-26 19:01:14
檢查爲該請求設置了什麼樣的mime類型,會告訴你你的apache配置是錯誤還是清單。 – roryf 2011-01-26 19:53:30