diff --git a/index.html b/index.html
index a9c8ce8f..971d034c 100644
--- a/index.html
+++ b/index.html
@@ -2999,6 +2999,21 @@
Contact Us
+
+
+
diff --git a/offline.html b/offline.html
new file mode 100644
index 00000000..0cd127ca
--- /dev/null
+++ b/offline.html
@@ -0,0 +1,196 @@
+
+
+
+
+
+ You're Offline - Travel Website
+
+
+
+
+
+
You're Currently Offline
+
Don't worry! You can still access previously loaded content. We'll automatically reconnect when your internet connection is restored.
+
+
+
+
+
+
+ Checking connection status...
+
+
+
+
+
\ No newline at end of file
diff --git a/service-worker.js b/service-worker.js
new file mode 100644
index 00000000..69e05d78
--- /dev/null
+++ b/service-worker.js
@@ -0,0 +1,51 @@
+const CACHE_NAME = 'offline-v1';
+const OFFLINE_URL = '/offline.html';
+
+self.addEventListener('install', (event) => {
+ event.waitUntil(
+ (async () => {
+ const cache = await caches.open(CACHE_NAME);
+ // Cache the offline page
+ await cache.add(new Request(OFFLINE_URL, { cache: 'reload' }));
+ })()
+ );
+ // Force the waiting service worker to become the active service worker
+ self.skipWaiting();
+});
+
+self.addEventListener('activate', (event) => {
+ event.waitUntil(
+ (async () => {
+ // Enable navigation preload if available
+ if ('navigationPreload' in self.registration) {
+ await self.registration.navigationPreload.enable();
+ }
+ })()
+ );
+ // Tell the active service worker to take control of the page immediately
+ self.clients.claim();
+});
+
+self.addEventListener('fetch', (event) => {
+ if (event.request.mode === 'navigate') {
+ event.respondWith(
+ (async () => {
+ try {
+ // First, try to use the navigation preload response if available
+ const preloadResponse = await event.preloadResponse;
+ if (preloadResponse) {
+ return preloadResponse;
+ }
+
+ // Try to fetch the request from the network
+ return await fetch(event.request);
+ } catch (error) {
+ // If fetch fails (offline), get the offline page from cache
+ const cache = await caches.open(CACHE_NAME);
+ const cachedResponse = await cache.match(OFFLINE_URL);
+ return cachedResponse;
+ }
+ })()
+ );
+ }
+});
\ No newline at end of file