Skip to content

Instantly share code, notes, and snippets.

@tutacat
Created September 10, 2023 16:16
Show Gist options
  • Save tutacat/2f49752ff463320c1b80117d8604188d to your computer and use it in GitHub Desktop.
Save tutacat/2f49752ff463320c1b80117d8604188d to your computer and use it in GitHub Desktop.
Userscript to prompt when closing ChatGPT tabs.
// ==UserScript==
// @name ChatGPT Confirm Close
// @namespace gptclose
// @match https://chat.openai.com/*
// @grant none
// @version 1.03
// @author tutacat
// @license MPL
// @description 3/8/2023, 10:00:00 PM
// ==/UserScript==
// https://greasyfork.org/scripts/472739-chatgpt-confirm-close
window.addEventListener("beforeunload", (event) => {
//// Is a chat open?
//if (!window.location.pathname.startsWith("/c/") {
event.preventDefault();
return false;
//}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment