ChatGPT Temporary Chat Toggle without reloading the web

Toggle temporary chat mode on chaptgpt with double shift key press without reloading

< Opiniones de ChatGPT Temporary Chat Toggle without reloading the web

Puntuación: Bueno; el script funciona tal y como promete

§
Publicado: 23/09/2025

Here's a way to fix the problem you're having when returning to the non-temporary chat:

You currently have:

                window.location.href = 'https://chatgpt.com';

You can replace it with:

                const root = new URL('/', url.origin);
                history.replaceState(null, '', root.toString());

This will stop the full page reload and go to the root on the same origin to avoid any cross-origin navigation.

Also, a small bug in your code, although it shouldn't affect things too much with your current code:

if (e.key !== 'Shift'&& e.location===KeyboardEvent.DOM_KEY_LOCATION_LEFT) return;

...this line allows almost any keystroke to get past it. The only ones it will stop are Left Alt, Left Ctrl and Left Meta/Windows. But your isShiftHeld flag does block all those other keystrokes, so the bug doesn't really harm anything.

To write that line properly, change it to:

if (e.key !== 'Shift' || e.location !== KeyboardEvent.DOM_KEY_LOCATION_LEFT) return;

or if you want it even simpler, write:

if (e.code !== 'ShiftLeft') return;

Publicar respuesta

Inicia sesión para responder.