summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html4
-rw-r--r--src/index.html4
-rw-r--r--src/scripts/service-worker.js46
-rw-r--r--src/sura.html4
4 files changed, 54 insertions, 4 deletions
diff --git a/index.html b/index.html
index cf8d5c9..7353851 100644
--- a/index.html
+++ b/index.html
@@ -3,6 +3,10 @@
<head>
<title>OpenQuran - Redirecting</title>
<link rel="manifest" href="src/manifest.json">
+ <!-- ios support -->
+ <link rel="apple-touch-icon" href="images/favicon.png">
+ <meta name="apple-mobile-web-app-status-bar" content="#f3f3f3">
+ <meta name="theme-color" content="#db4938" />
</head>
<body>
diff --git a/src/index.html b/src/index.html
index 6830dc6..60251b9 100644
--- a/src/index.html
+++ b/src/index.html
@@ -11,6 +11,10 @@
<link href="styles/css/solid.css" rel="stylesheet">
<link rel="icon" href="images/favicon.png">
<link rel="manifest" href="manifest.json">
+ <!-- ios support -->
+ <link rel="apple-touch-icon" href="images/favicon.png">
+ <meta name="apple-mobile-web-app-status-bar" content="#f3f3f3">
+ <meta name="theme-color" content="#db4938" />
<title>OpenQuran</title>
</head>
diff --git a/src/scripts/service-worker.js b/src/scripts/service-worker.js
index 2911784..19f58b8 100644
--- a/src/scripts/service-worker.js
+++ b/src/scripts/service-worker.js
@@ -22,12 +22,11 @@ const assets = [
"../src/scripts/quran.js",
"../src/scripts/sura-list.js",
];
-
+/*
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticQuran).then(cache => {
- for (var i = 0; i < assets.length; i++)
- {
+ for (var i = 0; i < assets.length; i++) {
cache.add(assets[i]);
}
})
@@ -40,4 +39,43 @@ self.addEventListener("fetch", fetchEvent => {
return res || fetch(fetchEvent.request);
})
)
-}) \ No newline at end of file
+})
+*/
+
+self.addEventListener('install', function (event) {
+ console.log('Service worker installed');
+
+ event.waitUntil(
+ caches.open('staticQuran')
+ .then(function (cache) {
+ console.log('Cache opened');
+ return cache.addAll(assets);
+ })
+ .then(function () {
+ console.log('Assets cached');
+ })
+ .catch(function (error) {
+ console.error('Error caching assets:', error);
+ })
+ );
+});
+
+self.addEventListener('fetch', function (event) {
+ console.log('Fetch event:', event.request.url);
+
+ event.respondWith(
+ caches.match(event.request)
+ .then(function (response) {
+ if (response) {
+ console.log('Cached response found:', response);
+ return response;
+ }
+
+ console.log('No cached response found, fetching from network');
+ return fetch(event.request);
+ })
+ .catch(function (error) {
+ console.error('Error fetching from cache:', error);
+ })
+ );
+}); \ No newline at end of file
diff --git a/src/sura.html b/src/sura.html
index c9ddd3b..73ef741 100644
--- a/src/sura.html
+++ b/src/sura.html
@@ -11,6 +11,10 @@
<link href="styles/css/solid.css" rel="stylesheet">
<link rel="icon" href="images/favicon.png">
<link rel="manifest" href="manifest.json">
+ <!-- ios support -->
+ <link rel="apple-touch-icon" href="images/favicon.png">
+ <meta name="apple-mobile-web-app-status-bar" content="#f3f3f3">
+ <meta name="theme-color" content="#db4938" />
<title>OpenQuran</title>
</head>