{"id":287532,"date":"2018-08-16T14:11:20","date_gmt":"2018-08-16T10:11:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287532"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287532","title":{"rendered":"PWA \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e. Hello Habr"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419585\/\" class=\"post__text post__text-html js-mediator-article\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 Progressive Web Applications. \u041f\u043e\u0441\u043b\u0435 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 <a href=\"https:\/\/habr.com\/post\/418923\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 PWA \u00abHello Habr\u00bb.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b-\/vw\/4c\/b-vw4cqjk2hjktpz8dxrwsbgkpy.jpeg\"><\/p>\n<p>  \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/altrusl.github.io\/habr-pwa\/hello-habr\/\">https:\/\/altrusl.github.io\/habr-pwa\/hello-habr\/<\/a>. \u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044f\u0440\u043b\u044b\u043a\u0430 \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u044d\u043a\u0440\u0430\u043d \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435, \u0442\u043e Chrome \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 PWA \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u0435\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0441 SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 &#171;Hello Habr&#187; \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Chrome <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/web-server-for-chrome\/ofhbbkphhbklhfoeikjpcbhemlocgigb\">\u0432\u043e\u0442 \u044d\u0442\u043e<\/a> \u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435, \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0411\u0435\u0437 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 PHP, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7r\/se\/s-\/7rses-k9ak4df9plysilwhlpxxe.jpeg\"><\/p>\n<p>  \u0424\u0430\u0439\u043b\u044b \u00abHello Habr\u00bb \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0441 GitHub-a \u2014 <a href=\"https:\/\/github.com\/altrusl\/habr-pwa\/tree\/master\/hello-habr\">https:\/\/github.com\/altrusl\/habr-pwa\/tree\/master\/hello-habr<\/a><\/p>\n<p>  \u041f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0435\u0435 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440\u0443.  <\/div>\n<\/div>\n<p>  \u00abHello Habr\u00bb \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041e\u043d \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 (\u043b\u043e\u0433\u043e) \u0438 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430\u0434\u043f\u0438\u0441\u044c.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">&#171;Hello Habr&#187; code<\/b><\/p>\n<div class=\"spoiler_text\">\n<h4>index.html<\/h4>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;html&gt;     &lt;head&gt;         &lt;title&gt;Hello Habr&lt;\/title&gt;         &lt;script src=\"hh.js\"&gt;&lt;\/script&gt;         &lt;link rel=\"stylesheet\" href=\"hh.css\" \/&gt;         &lt;script type=\"text\/javascript\"&gt;             if ('serviceWorker' in navigator) {                 navigator.serviceWorker.register('\/sw.js')                 .then(function(registration) {                     console.log('Registration successful, scope is:', registration.scope);                 })                 .catch(function(error) {                     console.log('Service worker registration failed, error:', error);                 });             }         &lt;\/script&gt;     &lt;\/head&gt;     &lt;body&gt;         &lt;div class=\"center\"&gt;             &lt;p id=\"text\"&gt;&lt;\/p&gt;         &lt;\/div&gt;         &lt;div id=\"logo\"&gt;&lt;\/div&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  <\/p>\n<h4>hh.css<\/h4>\n<p>  <\/p>\n<pre><code class=\"css\">@font-face {     font-family: Zaplyv-Heavy;     src: url(Zaplyv-Heavy.otf);    }     body {     display: flex;     align-items: center;     align-content: center;      justify-content: center;      overflow: auto;    }  .center {     font-family: Zaplyv-Heavy;     font-size: 8vmax; }  #logo {     background-image: url(logo.jpg);     background-size: 100%;     width: 100px;     height: 100px;     position: absolute;     top: 0;     right: 0;     margin: 10px; }<\/code><\/pre>\n<p>  <\/p>\n<h4>hh.js<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">window.onload = function() {     fetch(\"hh.txt?mode=nocache\").then(data =&gt; data.text()).then(data =&gt; {         animateText(data)       }); }  function animateText(data) {     var ele = document.getElementById(\"text\"),         txt = data.split(\"\");     var interval = setInterval(function(){     if(!txt[0]){         return clearInterval(interval);     };     ele.innerHTML += txt.shift();     }, 150); }<\/code><\/pre>\n<p>  <\/p>\n<h4>hh.txt<\/h4>\n<p>  <\/p>\n<pre><code class=\"java\">Hello Hubr<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442. \u0418\u0442\u043e\u0433\u043e \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043b\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0435\u0431 \u0441\u0430\u0439\u0442\u0430. \u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c index.html \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0438 \u043d\u0430\u0434\u043f\u0438\u0441\u044c. \u041d\u0430\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f javascript-\u043e\u043c \u0447\u0435\u0440\u0435\u0437 fetch \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 hh.txt \u2014 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0449\u0435\u0433\u043e PWA \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u0435\u0437 sw.js, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432\u0435\u0431 \u0441\u0430\u0439\u0442. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0430\u0448\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c Service Worker.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">sw.js<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">\/\/ Caches var CURRENT_CACHES = {     font: 'font-cache-v1',     css:'css-cache-v1',     js:'js-cache-v1',     site: 'site-cache-v1',     image: 'image-cache-v1' };  self.addEventListener('install', (event) =&gt; {   self.skipWaiting();     console.log('Service Worker has been installed'); });  self.addEventListener('activate', (event) =&gt; {     var expectedCacheNames = Object.keys(CURRENT_CACHES).map(function(key) {         return CURRENT_CACHES[key];     });        \/\/ Delete out of date caches     event.waitUntil(         caches.keys().then(function(cacheNames) {             return Promise.all(                 cacheNames.map(function(cacheName) {                     if (expectedCacheNames.indexOf(cacheName) == -1) {                         console.log('Deleting out of date cache:', cacheName);                         return caches.delete(cacheName);                     }                 })             );         })     );      console.log('Service Worker has been activated');   });  self.addEventListener('fetch', function(event) {   console.log('Fetching:', event.request.url);     event.respondWith(async function() {     const cachedResponse = await caches.match(event.request);     if (cachedResponse) {       console.log(\"\\tCached version found: \" + event.request.url);       return cachedResponse;     } else {               console.log(\"\\tGetting from the Internet:\" + event.request.url);       return await fetchAndCache(event.request);     }   }());  });  function fetchAndCache(request) {    return fetch(request)   .then(function(response) {     \/\/ Check if we received a valid response     if (!response.ok) {       return response;       \/\/ throw Error(response.statusText);     }          var url = new URL(request.url);     if (response.status &lt; 400 &amp;&amp;       response.type === 'basic' &amp;&amp;       url.search.indexOf(\"mode=nocache\") == -1        ) {       var cur_cache;       if (response.headers.get('content-type') &amp;&amp;          response.headers.get('content-type').indexOf(\"application\/javascript\") &gt;= 0) {         cur_cache = CURRENT_CACHES.js;       } else if (response.headers.get('content-type') &amp;&amp;              response.headers.get('content-type').indexOf(\"text\/css\") &gt;= 0) {         cur_cache = CURRENT_CACHES.css;       } else if (response.headers.get('content-type') &amp;&amp;              response.headers.get('content-type').indexOf(\"font\") &gt;= 0) {         cur_cache = CURRENT_CACHES.font;       } else if (response.headers.get('content-type') &amp;&amp;              response.headers.get('content-type').indexOf(\"image\") &gt;= 0) {         cur_cache = CURRENT_CACHES.image;       } else if (response.headers.get('content-type') &amp;&amp;              response.headers.get('content-type').indexOf(\"text\") &gt;= 0) {         cur_cache = CURRENT_CACHES.site;       }       if (cur_cache) {         console.log('\\tCaching the response to', request.url);         return caches.open(cur_cache).then(function(cache) {           cache.put(request, response.clone());           return response;         });       }     }     return response;   })   .catch(function(error) {     console.log('Request failed for: ' + request.url, error);     throw error;   }); }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u044f\u0442\u044c \u043a\u044d\u0448\u0435\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u041a\u044d\u0448 site \u2014 \u0434\u043b\u044f html \u0444\u0430\u0439\u043b\u043e\u0432. \u041a\u044d\u0448\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0445, \u0443 \u043a\u043e\u0433\u043e \u0432 GET query \u0441\u0442\u043e\u0438\u0442 \u00abmode=nocache\u00bb \u2014 \u0430 \u044d\u0442\u043e \u0443 \u043d\u0430\u0441 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0444\u0430\u0439\u043b\u0443 hh.txt \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0434\u043b\u044f \u043d\u0430\u0434\u043f\u0438\u0441\u0438.   <\/p>\n<blockquote><p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0441\u0443\u0440\u0441 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u043a\u044d\u0448\u0430. \u042d\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 Service Worker-\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u043a\u044d\u0448 (\u043a\u044d\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430) \u043b\u0443\u0447\u0448\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c. \u0418 \u043d\u0435 \u0443 \u0441\u0435\u0431\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">.htaccess<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\"># Cache-Control Headers &lt;ifModule mod_headers.c&gt;   &lt;FilesMatch (\\.css|\\.js|sprites\\.png)$&gt; \tHeader unset ETag \tHeader unset Expires \tHeader set Cache-Control \"no-cache\"   &lt;\/FilesMatch&gt; &lt;\/IfModule&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<\/blockquote>\n<p>  \u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b sw.js \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u2014 \u00abCache falling back to the network\u00bb. \u0421\u043f\u0435\u0440\u0432\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u044d\u0448\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d \u0442\u0430\u043c \u0435\u0441\u0442\u044c, \u0442\u043e \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u043e\u0442\u0442\u0443\u0434\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0435\u0442\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443, \u0430 \u043a\u043e\u043f\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u044d\u0448.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b index.html \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 Chrom-a \u0432\u0438\u0434\u043d\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0431 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 Service Worker-\u0430. \u041f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u043a\u044d\u0448\u0438 \u0438 \u0432 \u043d\u0438\u0445 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u0422\u0430\u043a\u0436\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f\u0445 \u043d\u0430 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0445\u043e\u0434\u044f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a hh.txt, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 Service Worker-a. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kd\/qp\/tz\/kdqptzafmxk0tx7xrnauezddwww.jpeg\">  <\/div>\n<\/div>\n<p>  \u0425\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e index.html, hh.css, hh.js, hh.otf, logo.jpg \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 application shell, \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0430\u044f \u0440\u043e\u043b\u044c \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435. \u0412\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0430\u0439\u0442\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f javascript \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 app shell-e. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043a text.txt.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c PWA, \u00abHello Habr\u00bb \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u2014 \u0438\u043a\u043e\u043d\u043a\u0438 \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u043e\u0432 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 index.html \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">manifest.json<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">{   \"short_name\": \"Hello Habr\",   \"name\": \"Hello Habr - PWA example\",   \"icons\": [     {       \"src\": \"logo3.jpg\",       \"type\": \"image\/jpg\",       \"sizes\": \"192x192\"     },     {       \"src\": \"logo2.jpg\",       \"type\": \"image\/jpg\",       \"sizes\": \"512x512\"     }   ],   \"start_url\": \"index.html\",   \"background_color\": \"#3367D6\",   \"display\": \"standalone\",   \"scope\": \"\/habr-pwa\/hello-habr\/\",   \"theme_color\": \"#3367D6\" }<\/code><\/pre>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u043d \u0432 index.html: <\/p>\n<pre><code class=\"xml\">&lt;link rel=\"manifest\" href=\"manifest.json\"&gt;<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b (\u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e-\u0441\u0432\u043e\u0435\u043c\u0443) \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0430\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044f\u0440\u043b\u044b\u043a \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u044d\u043a\u0440\u0430\u043d\u0435. \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u043e \u044f\u0440\u043b\u044b\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <i>standalone<\/i> \u0440\u0435\u0436\u0438\u043c\u0435 \u2014 \u0431\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043e\u0431 \u043e\u043f\u0446\u0438\u044f\u0445 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 \u2014 \u043d\u0430 <a href=\"https:\/\/developers.google.com\/web\/fundamentals\/web-app-manifest\/\">Google Developers<\/a>.<\/p>\n<p>  \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00abHello Habr\u00bb \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0432\u0441\u0435\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 PWA \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c \u043f\u043e \u0441\u0443\u0442\u0438. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0430\u0439\u0442 \u0432 PWA \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0438 \u0444\u0430\u0439\u043b Service Worker-a. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 sw.js \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0432 PWA \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0441\u0430\u0439\u0442 \u043d\u0430 CMS Joomla (\u0441\u0430\u0439\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u0441 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0435\u043c\u043e-\u0434\u0430\u043d\u043d\u044b\u043c\u0438). \u041f\u0440\u0438\u0447\u0435\u043c, sw.js \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0435\u043c \u0436\u0435.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/419585\/\"> https:\/\/habr.com\/post\/419585\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419585\/\" class=\"post__text post__text-html js-mediator-article\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 Progressive Web Applications. \u041f\u043e\u0441\u043b\u0435 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 <a href=\"https:\/\/habr.com\/post\/418923\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 PWA \u00abHello Habr\u00bb.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b-\/vw\/4c\/b-vw4cqjk2hjktpz8dxrwsbgkpy.jpeg\"><\/p>\n<p>  \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/altrusl.github.io\/habr-pwa\/hello-habr\/\">https:\/\/altrusl.github.io\/habr-pwa\/hello-habr\/<\/a>. \u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044f\u0440\u043b\u044b\u043a\u0430 \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u044d\u043a\u0440\u0430\u043d \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-287532","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=287532"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287532\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}