简体   繁体   中英

If a file is listed in a cache manifest but not placed into the page's document, will it be cached?

I have a bunch of files listed in a cache manifest . Firefox's network tab shows the page being loaded and cached but the files listed do not show ever being loaded or cached. They are not added to the page until someone clicks a proper button and then they (videos) are placed into the document and loaded by JavaScript.

Will all the HTML5 compliant browsers still cache all files in a manifest, or do they need to be added to the document at load time?

MANIFEST

CACHE MANIFEST

# Manifest last updated: 2015-09-13 13:05:31

CACHE:
stylesheets/desktop.css
stylesheets/tablet.css
scripts/script.js
videos/test.mp4

MAIN PAGE CALL TO MANIFEST

<!DOCTYPE html>
<html manifest="manifest.appcache">

The video is inserted in JavaScript when the user clicks to play it. Do I need to add it to the page during load to make it cached?

The browser will cache any file in a manifest whenever that file is first requested. Files in manifests don't need to be loaded at the time of the document load event.

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