0

Open Instagram

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Detect User Country and Show Flag</title> </head> <body> <h1>User Country Flag</h1> <div id="flag-container"> <p>Loading flag...</p> </div> <script> // Your IPinfo API token const ipinfoToken = '23b1072c035bfd'; async function getUserCountry() { try { const response = await fetch(`https://ipinfo.io?token=${ipinfoToken}`); const data = await response.json(); return data.country; } catch (error) { console.error('Error fetching user country:', error); return null; } } function showCountryFlag(countryCode) { const flagContainer = document.getElementById('flag-container'); if (countryCode) { const flagImg = document.createElement('img');

8th Aug 2024, 2:30 AM
Jhantu Mahato
Jhantu Mahato - avatar
1 Antwort
+ 3
Jhantu Mahato I don't see a question as much as a wall of code leading to ???? Please follow the forum guidelines https://www.sololearn.com/discuss/1316935/?ref=app https://www.sololearn.com/discuss/3021159/?ref=app
8th Aug 2024, 4:01 AM
BroFar
BroFar - avatar