“Listen Back Tombol Event Listner” Kode Jawaban

Listen Back Tombol Event Listner

window.history.pushState({page: 1}, "", "");

window.onpopstate = function(event) {

  // "event" object seems to contain value only when the back button is clicked
  // and if the pop state event fires due to clicks on a button
  // or a link it comes up as "undefined" 

  if(event){
    // Code to handle back button or prevent from navigation
  }
  else{
    // Continue user action through link or button
  }
}
Clever Chamois

Kembali Tombol Acara Pendengar JavaScript

function goBack() {
    window.location.hash = window.location.lasthash[window.location.lasthash.length-1];
 	window.location.lasthash.pop();
}
Undefined

Jawaban yang mirip dengan “Listen Back Tombol Event Listner”

Pertanyaan yang mirip dengan “Listen Back Tombol Event Listner”

Lebih banyak jawaban terkait untuk “Listen Back Tombol Event Listner” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya