“JavaScript howdo saya mengarahkan ke halaman web lain” Kode Jawaban

Redirect JavaScript

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
FloatDev

Javascript Redirect

<script>
  window.location.href = "http://mywebsite.com/home.html";
</script>
Bored Beaver

Javascript Redirect

window.location.href = "http://mywebsite.com/home.html";
Grepper

Javascript Redirect

<p onclick="myFunction()"></p>
<script>
function myFunction() {
	  window.location.href = "https://whereyouwouldliketogo.com"
}
</script>
Donald Duck

JavaScript howdo saya mengarahkan ke halaman web lain

var url = "https://www.hrefcode.com/question/25/how-do-i-redirect-to-another-webpage-with-use-of-javascript";
$(location).attr('href',url);
Fragile Finch

JavaScript howdo saya mengarahkan ke halaman web lain

// similar behavior as an HTTP redirect
window.location.replace("https://www.hrefcode.com");

// similar behavior as clicking on a link
window.location.href = "https://www.hrefcode.com";
Precious Pigeon

Jawaban yang mirip dengan “JavaScript howdo saya mengarahkan ke halaman web lain”

Pertanyaan yang mirip dengan “JavaScript howdo saya mengarahkan ke halaman web lain”

Lebih banyak jawaban terkait untuk “JavaScript howdo saya mengarahkan ke halaman web lain” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya