Rox-Turbo commited on
Commit
e2e3ec1
·
verified ·
1 Parent(s): b8c0f4c

Update public/terminated.html

Browse files
Files changed (1) hide show
  1. public/terminated.html +17 -9
public/terminated.html CHANGED
@@ -133,25 +133,33 @@
133
  sessionStorage.clear();
134
 
135
  // Clear cookies
136
- document.cookie.split(';').forEach(function(c) {
137
- document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');
138
- });
 
 
 
 
139
 
140
  // Unregister service workers
141
  if ('serviceWorker' in navigator) {
142
  navigator.serviceWorker.getRegistrations().then(function(registrations) {
143
- registrations.forEach(function(registration) {
144
- registration.unregister();
145
- });
 
 
146
  });
147
  }
148
 
149
  // Clear caches
150
  if ('caches' in window) {
151
  caches.keys().then(function(names) {
152
- names.forEach(function(name) {
153
- caches.delete(name);
154
- });
 
 
155
  });
156
  }
157
  } catch (e) {}
 
133
  sessionStorage.clear();
134
 
135
  // Clear cookies
136
+ var cookies = document.cookie.split(';');
137
+ for (var i = 0; i < cookies.length; i++) {
138
+ var cookie = cookies[i];
139
+ var eqPos = cookie.indexOf('=');
140
+ var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
141
+ document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/';
142
+ }
143
 
144
  // Unregister service workers
145
  if ('serviceWorker' in navigator) {
146
  navigator.serviceWorker.getRegistrations().then(function(registrations) {
147
+ for (var i = 0; i < registrations.length; i++) {
148
+ registrations[i].unregister();
149
+ }
150
+ }).catch(function(err) {
151
+ // Silent fail - service worker cleanup is best effort
152
  });
153
  }
154
 
155
  // Clear caches
156
  if ('caches' in window) {
157
  caches.keys().then(function(names) {
158
+ for (var i = 0; i < names.length; i++) {
159
+ caches.delete(names[i]);
160
+ }
161
+ }).catch(function(err) {
162
+ // Silent fail - cache cleanup is best effort
163
  });
164
  }
165
  } catch (e) {}