简体   繁体   中英

How to set up offline manifest for a web app to run in Safari in iOS?

I'm currently trying to set up an offline.manifest file for my web app to be used offline on an iOS device. For testing purposes I have a very simple HTML page that I'm trying to add to a home screen. I'm testing it on a live iPhone 4, but after the page is added to the home screen and I put the iPhone in the airplane mode and try to start my web app I get this error:

"Turn Off Airplane Mode or Use Wi-Fi to Access Data"

and then if I click OK I get:

"Cannot Open Web App Name" "Web App Name could not be opened because it is not connected to the Internet"

The following is added to the HTML file:

<!DOCTYPE html>
<html lang="en" manifest="scrts/offline.manifest">

and the offline.manifest is composed as such:

CACHE MANIFEST

../pics/bkgnd_iphn_settings.png
../pics/mbl_btn_fb.png
../pics/mbl_btn_twt.png
../pics/icon_57_57_bg.png
../pics/icon_72_72_bg.png
../pics/icon_114_114_bg.png
../pics/icon_144_144_bg.png
../pics/splash_320_460_bg.png
../pics/splash_768_1004_bg.png
../pics/splash_1004_768_bg.png

I got all instructions on composing it from here

I also adjusted the .htaccess file to add this line:

AddType text/cache-manifest .manifest

Any idea what am I not doing right?

This tutorial is pretty good and if your pages are generated dynamically, you may use a .htaccess to rewrite domain.com/script.html to domain.com/script.php and then call the *.html from your app. This way the content on the device is saved as html and could be delivered statically. You can also add fallback urls/files to your manifest file which may be useful if your content is dynamically by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM