Abdfah commited on
Commit
5e3e3b6
·
verified ·
1 Parent(s): 0a2257e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +99 -18
index.html CHANGED
@@ -1,19 +1,100 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Device & Browser Info Extractor</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ background-color: #f4f4f9;
12
+ }
13
+ #info-container {
14
+ margin-top: 20px;
15
+ padding: 15px;
16
+ border: 1px solid #ccc;
17
+ border-radius: 8px;
18
+ background-color: #fff;
19
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
20
+ }
21
+ h1 {
22
+ color: #333;
23
+ text-align: center;
24
+ }
25
+ button {
26
+ display: block;
27
+ width: 100%;
28
+ padding: 10px;
29
+ background-color: #007bff;
30
+ color: white;
31
+ border: none;
32
+ border-radius: 5px;
33
+ cursor: pointer;
34
+ font-size: 16px;
35
+ transition: background-color 0.3s;
36
+ }
37
+ button:hover {
38
+ background-color: #0056b3;
39
+ }
40
+ pre {
41
+ white-space: pre-wrap; /* Ensures long lines wrap */
42
+ word-wrap: break-word; /* For older browsers */
43
+ background-color: #e9ecef;
44
+ padding: 10px;
45
+ border-radius: 4px;
46
+ overflow-x: auto; /* Adds a scrollbar if content is too wide */
47
+ }
48
+ </style>
49
+ </head>
50
+ <body>
51
+
52
+ <h1>Device and Browser Information</h1>
53
+
54
+ <button id="testButton">Test Button: Extract Info</button>
55
+
56
+ <div id="info-container">
57
+ <p>Press the button above to display your device and browser information.</p>
58
+ <pre id="info-display"></pre>
59
+ </div>
60
+
61
+ <script>
62
+ document.getElementById('testButton').addEventListener('click', function() {
63
+ // The 'navigator' object is the primary source for browser and device info in JS
64
+ const nav = window.navigator;
65
+
66
+ // --- Collect all the information ---
67
+ let deviceInfo = {
68
+ // Browser Information
69
+ 'Browser User Agent (Raw)': nav.userAgent, // The full string
70
+ 'Browser Code Name': nav.appCodeName,
71
+ 'Browser Name': nav.appName,
72
+ 'Browser Version': nav.appVersion,
73
+ 'Platform/OS': nav.platform,
74
+ 'Browser Language': nav.language || nav.userLanguage,
75
+ 'Online Status': nav.onLine ? 'Online' : 'Offline',
76
+ 'Cookies Enabled': nav.cookieEnabled ? 'Yes' : 'No',
77
+
78
+ // Device/Screen Information
79
+ 'Screen Width': window.screen.width + ' px',
80
+ 'Screen Height': window.screen.height + ' px',
81
+ 'Color Depth': window.screen.colorDepth + ' bits',
82
+
83
+ // Device-specific properties (modern)
84
+ 'Max Touch Points': nav.maxTouchPoints, // Useful for detecting touch devices
85
+ 'Hardware Concurrency': nav.hardwareConcurrency, // Number of logical processor cores
86
+ };
87
+
88
+ // --- Format the information for display ---
89
+ let displayString = '';
90
+ for (const [key, value] of Object.entries(deviceInfo)) {
91
+ displayString += `${key}: ${value}\n`;
92
+ }
93
+
94
+ // --- Display the information on the screen ---
95
+ document.getElementById('info-display').textContent = displayString;
96
+ });
97
+ </script>
98
+
99
+ </body>
100
  </html>