Advertisement
Guest User

Untitled

a guest
Dec 19th, 2011
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. === index.html ===
  2.  
  3. <!doctype html>
  4. <html manifest="test.appcache">
  5. <head>
  6. <meta charset="utf-8">
  7. <title>Connectivity Test</title>
  8. <script src="online.js"></script>
  9. <script src="script.js"></script>
  10. </head>
  11.  
  12. <body>
  13. <h1>Let's test this connection!</h1>
  14. <button onclick="go()">Do it!</button>
  15. </body>
  16. </html>
  17.  
  18. === script.js ===
  19.  
  20. function go() {
  21. isSiteOnline() ? alert("Online") : alert("Offline");
  22. }
  23.  
  24. === online.js ===
  25.  
  26. function isSiteOnline() {
  27. return true;
  28. }
  29.  
  30. === offline.js ===
  31.  
  32. function isSiteOnline() {
  33. return false;
  34. }
  35.  
  36. === test.appcache ===
  37.  
  38. CACHE MANIFEST
  39.  
  40. # Version: 1
  41.  
  42. CACHE:
  43. index.html
  44. script.js
  45.  
  46. NETWORK:
  47. *
  48.  
  49. FALLBACK:
  50. online.js offline.js
  51.  
  52. === .htaccess ===
  53.  
  54. AddType text/cache-manifest .appcache
  55.  
  56. <IfModule mod_expires.c>
  57. ExpiresActive on
  58. ExpiresDefault "access plus 1 month"
  59.  
  60. ExpiresByType text/cache-manifest "access plus 0 seconds"
  61. ExpiresByType text/html "access plus 0 seconds"
  62. ExpiresByType application/json "access plus 0 seconds"
  63. ExpiresByType text/css "access plus 0 seconds"
  64. ExpiresByType application/javascript "access plus 0 seconds"
  65.  
  66. <IfModule mod_headers.c>
  67. Header append Cache-Control "public"
  68. </IfModule>
  69.  
  70. </IfModule>
  71.  
  72. <IfModule mod_headers.c>
  73. Header unset ETag
  74. </IfModule>
  75.  
  76. FileETag None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement