File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,15 @@ math: false
24
24
<script >
25
25
async function fetchIP () {
26
26
try {
27
- let ipv4 = await fetch ( " https://api64.ipify.org?format=json " ). then ( res => res . json ());
28
- let ipv6 = await fetch (" https://api6 .ipify.org?format=json" ).then (res => res .json ());
27
+ // Fetching the IP address from a single source
28
+ let response = await fetch (" https://api64 .ipify.org?format=json" ).then (res => res .json ());
29
29
30
+ // Assigning the IP to both IPv4 and IPv6 (same IP for simplicity in this case)
30
31
let ipv4Elem = document .getElementById (" ipv4" );
31
32
let ipv6Elem = document .getElementById (" ipv6" );
32
33
33
- ipv4Elem .textContent = ipv4 .ip ;
34
- ipv6Elem .textContent = ipv6 .ip ;
34
+ ipv4Elem .textContent = response .ip ;
35
+ ipv6Elem .textContent = response .ip ;
35
36
36
37
ipv4Elem .classList .add (" show" );
37
38
ipv6Elem .classList .add (" show" );
You can’t perform that action at this time.
0 commit comments