“Hapus cookie” Kode Jawaban

JavaScript Hapus Cookie

function deleteCookie(name) {
  document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
TC5550

Hapus cookie

document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
Ivan Cuaco

Hapus cookie

function onRemoved(cookie) {
  console.log(`Removed: ${cookie}`);
}

function onError(error) {
  console.log(`Error removing cookie: ${error}`);
}

function removeCookie(tabs) {
  var removing = browser.cookies.remove({
    url: tabs[0].url,
    name: "favorite-color"
  });
  removing.then(onRemoved, onError);
}

var getActive = browser.tabs.query({active: true, currentWindow: true});
getActive.then(removeCookie);
Tung

Hapus cookie

Cookie userNameCookieRemove = new Cookie("userName", "");
userNameCookieRemove.setMaxAge(0);
response.addCookie(userNameCookieRemove);
Lorenzo Scillone

Jawaban yang mirip dengan “Hapus cookie”

Pertanyaan yang mirip dengan “Hapus cookie”

Lebih banyak jawaban terkait untuk “Hapus cookie” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya