How to create a stand-alone web application so that when a user visits hxxp: // mywebsite / and is disconnected than hxxp: // mywebsite / offline /. [There are about 100 different dynamic pages on my website, so I cannot transcode them into a cache manifest file]
CACHE MANIFEST CACHE: /Offline/OfflineIndex.html FALLBACK: / /Offline/OfflineIndex.html NETWORK: *
. - , , . , , , . , , html (IE. Synchronize.html), , , cookie localcache. synchronize.html , localcache .
OFFLINE AWESOMENESSSSSSSSSSS!!!!
"manifest.php" "cache.manifest", php :
<?php header('Content-Type: text/cache-manifest'); echo "CACHE MANIFEST\n"; $hashes = ""; $dir = new RecursiveDirectoryIterator("."); foreach(new RecursiveIteratorIterator($dir) as $file) { $info = pathinfo($file); if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFilename(), 0, 1) != ".") { echo $file . "\n"; $hashes .= md5_file($file); } } echo "# Hash: " . md5($hashes) . "\n"; ?>
, - . , :)
, , , . , script .
Link to the manifest file in an invisible iframe on the index page. This way, your index page is not cached, as usual by default, and you have full control over your backups ...
No need for unreliable cookies or localStorage!
Source: https://habr.com/ru/post/1765121/More articles:Related List in C - cHow do I know which tables have foreign keys on my table? - sqlUsing Wi-Fi to triangulate instead of GPS - mobileHow can I run a Rails 1.2.5 application on ruby 1.9? - ruby-on-railsurl encoding in web.config - asp.netWhat does {0} mean in a PHP expression? - phpfunction template pointer - c ++range-based number of columns - sql-serverWhich do you prefer: handling C ++ exceptions or passing a buffer to store error messages as a parameter? - c ++Check for referential integrity - mysqlAll Articles