-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaudetest.html
More file actions
211 lines (200 loc) · 7.57 KB
/
claudetest.html
File metadata and controls
211 lines (200 loc) · 7.57 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IP Address & Geolocation Viewer</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f0f2f5;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 90%;
max-width: 600px;
padding: 2rem;
}
h1 {
color: #2c3e50;
text-align: center;
margin-bottom: 1.5rem;
}
.info-card {
background-color: #f8f9fa;
border-radius: 8px;
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.info-row {
display: flex;
padding: 0.5rem 0;
border-bottom: 1px solid #e0e0e0;
}
.info-row:last-child {
border-bottom: none;
}
.info-label {
font-weight: bold;
width: 140px;
color: #555;
flex-shrink: 0;
}
.info-value {
color: #2c3e50;
}
.loading {
text-align: center;
color: #666;
font-style: italic;
}
.error {
background-color: #ffebee;
color: #c62828;
padding: 1rem;
border-radius: 8px;
text-align: center;
margin-bottom: 1rem;
}
.map-container {
height: 300px;
border-radius: 8px;
overflow: hidden;
margin-bottom: 1.5rem;
}
.map-placeholder {
height: 100%;
background-color: #e0e0e0;
display: flex;
justify-content: center;
align-items: center;
color: #666;
}
.footer {
text-align: center;
font-size: 0.8rem;
color: #666;
margin-top: 1.5rem;
}
</style>
</head>
<body>
<div class="container">
<h1>Your IP & Location</h1>
<div id="error" class="error" style="display: none;">
Unable to fetch location data. Please try again later.
</div>
<div id="loading" class="loading">
Fetching your information...
</div>
<div id="ipInfo" class="info-card" style="display: none;">
<div class="info-row">
<div class="info-label">IP Address:</div>
<div id="ipAddress" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">Country:</div>
<div id="country" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">Region:</div>
<div id="region" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">City:</div>
<div id="city" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">Postal Code:</div>
<div id="postalCode" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">Latitude:</div>
<div id="latitude" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">Longitude:</div>
<div id="longitude" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">Timezone:</div>
<div id="timezone" class="info-value">-</div>
</div>
<div class="info-row">
<div class="info-label">ISP:</div>
<div id="isp" class="info-value">-</div>
</div>
</div>
<div class="map-container" id="mapContainer">
<div class="map-placeholder" id="mapPlaceholder">
Map will appear here when location is loaded
</div>
</div>
<div class="footer">
<p>This page uses the ipify API to determine your IP address and the ipinfo.io API for geolocation data.</p>
<p>Note: Geolocation data might not be 100% accurate as it's based on IP address information.</p>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const loading = document.getElementById('loading');
const error = document.getElementById('error');
const ipInfo = document.getElementById('ipInfo');
const mapPlaceholder = document.getElementById('mapPlaceholder');
// Fetch the IP address first
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
const ip = data.ip;
document.getElementById('ipAddress').textContent = ip;
// Now fetch the geolocation data
return fetch(`https://ipinfo.io/${ip}/json`);
})
.then(response => response.json())
.then(data => {
// Display the data
document.getElementById('country').textContent = data.country || 'Unknown';
document.getElementById('region').textContent = data.region || 'Unknown';
document.getElementById('city').textContent = data.city || 'Unknown';
document.getElementById('postalCode').textContent = data.postal || 'Unknown';
document.getElementById('timezone').textContent = data.timezone || 'Unknown';
document.getElementById('isp').textContent = data.org || 'Unknown';
// Handle coordinates
if (data.loc) {
const [lat, lon] = data.loc.split(',');
document.getElementById('latitude').textContent = lat;
document.getElementById('longitude').textContent = lon;
// Update map placeholder with link to online map
mapPlaceholder.innerHTML = `
<iframe
width="100%"
height="100%"
frameborder="0"
scrolling="no"
marginheight="0"
marginwidth="0"
src="https://maps.google.com/maps?q=${lat},${lon}&z=12&output=embed">
</iframe>
`;
}
// Show the info and hide loading
loading.style.display = 'none';
ipInfo.style.display = 'block';
})
.catch(err => {
console.error('Error fetching data:', err);
loading.style.display = 'none';
error.style.display = 'block';
});
});
</script>
</body>
</html>