-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
47 lines (41 loc) · 1.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Web Browser</title>
<!-- Include your CSS and other dependencies here -->
</head>
<body>
<h1>My Web Browser</h1>
<!-- Your browser interface goes here -->
<!-- Add buttons, input fields, etc. -->
<script>
// Client-side storage using Local Storage
function saveToLocalStorage(key, value) {
localStorage.setItem(key, JSON.stringify(value));
}
function getFromLocalStorage(key) {
const storedValue = localStorage.getItem(key);
return storedValue ? JSON.parse(storedValue) : null;
}
// Example usage:
saveToLocalStorage('userPreferences', { darkMode: true });
const preferences = getFromLocalStorage('userPreferences');
console.log('User preferences:', preferences);
// Database (server-side)
// Set up your server (e.g., using Node.js and Express)
// Connect to your database (e.g., MySQL, PostgreSQL, MongoDB)
// Service Worker for app installation (PWA)
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js')
.then(registration => {
console.log('Service Worker registered with scope:', registration.scope);
})
.catch(error => {
console.error('Service Worker registration failed:', error);
});
}
</script>
</body>
</html>