Javascript: How To Cache Small MP3 File For Offline Play?
I'm building an alarm web app that needs to work offline. How can I cache the small mp3 ringtone so that the alarm still sounds when the app is offline?
Solution 1:
You can cache using webSQL, indexdb, localstorage, or a cookie. I think using the localstorage would be the simplest solution.
Simple add an appdata.manifest file which has the ringtones you want to store. then in the html tag add
<html lang="en" manifest="appdata.manifest">
the cache file
CACHE MANIFEST
NETWORK:
/page.html
CACHE:
# v0
# This file will tell the broweser what needs to be Cached
# Spaces are ignored
# Blank Lines are ignored
/music/music.mp3
Post a Comment for "Javascript: How To Cache Small MP3 File For Offline Play?"