Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -443,21 +443,29 @@ def main():
|
|
443 |
gr.HTML("""
|
444 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
445 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
446 |
""")
|
447 |
-
|
448 |
-
#
|
449 |
gr.HTML("""
|
450 |
-
<link rel="manifest" href="manifest.json">
|
|
|
451 |
""")
|
452 |
-
|
453 |
-
#
|
454 |
-
gr.HTML(
|
455 |
<script>
|
456 |
-
if ('serviceWorker' in navigator) {
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
</script>
|
462 |
""")
|
463 |
# Header HTML
|
|
|
443 |
gr.HTML("""
|
444 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
445 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
446 |
+
<meta name="apple-mobile-web-app-title" content="PawMatch AI">
|
447 |
""")
|
448 |
+
|
449 |
+
# 第二層:添加 PWA 相關的連結
|
450 |
gr.HTML("""
|
451 |
+
<link rel="manifest" href="./manifest.json">
|
452 |
+
<link rel="apple-touch-icon" href="./assets/icon-192.png">
|
453 |
""")
|
454 |
+
|
455 |
+
# 第三層:Service Worker 註冊
|
456 |
+
gr.HTML("""
|
457 |
<script>
|
458 |
+
if ('serviceWorker' in navigator) {
|
459 |
+
window.addEventListener('load', function() {
|
460 |
+
navigator.serviceWorker.register('./service-worker.js')
|
461 |
+
.then(function(registration) {
|
462 |
+
console.log('成功註冊 Service Worker');
|
463 |
+
})
|
464 |
+
.catch(function(error) {
|
465 |
+
console.log('Service Worker 註冊失敗:', error);
|
466 |
+
});
|
467 |
+
});
|
468 |
+
}
|
469 |
</script>
|
470 |
""")
|
471 |
# Header HTML
|