Update index.html
Browse files- index.html +99 -18
index.html
CHANGED
|
@@ -1,19 +1,100 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>
|