При нажатии на ссылки в Facebook Mobile Browser открывается автономный файл, указанный serviceworker.
Мы внедрили serviceworker на наших веб-сайтах, который, если веб-сайт отключен, загружает html-страницу из кэша.
Я пытался удалить сервер работника, но браузер внутри приложения по-прежнему загружает автономную страницу
Наш сервер работ выглядит следующим образом
//This is the "Offline page" service worker
//Install stage sets up the offline page in the cache and opens a new cache
self.addEventListener('install', function(event) {
var offlinePage = new Request('/CMSContent/Pages/Offline.html');
event.waitUntil(
fetch(offlinePage).then(function(response) {
return caches.open('sw-offline').then(function(cache) {
return cache.put(offlinePage, response);
});
}));
});
//If any fetch fails, it will show the offline page.
//Maybe this should be limited to HTML documents?
self.addEventListener('fetch', function(event) {
event.respondWith(
fetch(event.request).catch(function (error) {
return caches.open('sw-offline').then(function(cache) {
return cache.match('/CMSContent/Pages/Offline.html');
});
}
));
});
//This is a event that can be fired from your page to tell the SW to update the offline page
self.addEventListener('refreshOffline', function(response) {
return caches.open('sw-offline').then(function(cache) {
return cache.put(offlinePage, response);
});
});
При нажатии на ссылки вПриложение Facebook, загружает автономную страницу.