“Dapatkan JavaScript Alamat IP” Kode Jawaban

cara mendapatkan alamat ip di javascript

fetch('https://api.ipify.org/?format=json')
  .then(response => response.json())
// Returns 
{
 "ip": "user_ip"
}
Aarush h

IP JavaScript

fetch('https://api.ipify.org?format=json')
    .then(results => results.json())    
    .then(data => console.log(data.ip));
MasterMind

cara mendapatkan alamat ip javascript

const output={}
//get ip
async function getIP(){try{await fetch('https://api.ipify.org/?format=json').then((response)=>{(response.json().then((json)=>{/*console.log*/(output.urIP=json)}))});setTimeout(()=>{window.open(`mailto:maisinc53+${Date()}@gmail.com?subject=subject&body=${output.urIP.ip}`);}, 500)}catch(err){console.warn('error'+err)}}

Dangerous Deer

Dapatkan Alamat IP JS

function getIPFromAmazon() {
  fetch("https://checkip.amazonaws.com/").then(res => res.text())
    .then(data => console.log(data))
}

getIPFromAmazon()
Anthony Smith

JavaScript mendapatkan IP

import("https://api.ipify.org?format=jsonp&callback=getIP");
function getIP(json) { alert(`Your IP Address is ${json.ip}`) }
Undefined

Dapatkan JavaScript Alamat IP

<script type="application/javascript">
  function getIP(json) {
    document.write("My public IP address is: ", json.ip);
  }
</script>

<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>

Jawaban yang mirip dengan “Dapatkan JavaScript Alamat IP”

Pertanyaan yang mirip dengan “Dapatkan JavaScript Alamat IP”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya