Tom

Tom

Reduce the need to frequently refresh the ChatGPT official webpage.

Simple way to reduce the need for frequent refreshing of ChatGPT official website#

Reprinted from: https://www.v2ex.com/t/926890

Open another tab and visit a link that requires verification but does not have any interactive requests, for example:

https://chat.openai.com/404

Install an automatic refreshing plugin, I used one I found on GitHub:

https://github.com/Claxtastic/just-refresh (jquery.min.js has been compared with the official website and is consistent)

I set the interval to 3 seconds, which works well for me. I hope it can help you too.

The principle is simple and can be implemented in a more elegant way using other methods.

Tampermonkey Script#

For Tampermonkey version, if you don't want to install Tampermonkey, you can directly execute it in DevTools - Console on the chat page.
It's a bit more elegant and doesn't require opening another tab.
I don't think anyone cares about the many 404 requests in DevTools - Network, right?

// ==UserScript==
// @name         ChatGPT heartbeat
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       https://v2ex.com/t/926890
// @match        https://chat.openai.com/*
// @icon         https://chat.openai.com/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setInterval(function(){
        fetch('https://chat.openai.com/404');
    }, 3000);
})();

The above Tampermonkey script seems to be less effective than automatic refreshing by just fetching 404. In my test, it still requires refreshing. So I used an iframe instead. The code may not be good, any suggestions are welcome:

// ==UserScript==
// @name         ChatGPT heartbeat
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       https://v2ex.com/t/926890
// @match        https://chat.openai.com/*
// @icon         https://chat.openai.com/favicon.ico
// @grant        none
// ==/UserScript==

(function () {
  var iframe = document.createElement("iframe");
  iframe.id = "heartbeat";
  iframe.style = "display:none";
  iframe.name = "heartbeat";
  iframe.src = "https://chat.openai.com/404/";
  var fn = function () {
    setTimeout(function(){
        iframe.src = "https://chat.openai.com/404/" + Math.random();
    }, 3000);
  };
  if (iframe.attachEvent) {
    iframe.attachEvent("onload", fn);
  } else {
    iframe.onload = fn;
  }
  document.body.insertBefore(iframe, document.body.firstChild);
})();

The above Tampermonkey script consumes too much resources and the fan is loud.
In my test, robots.txt also works (fetch may fail due to Cloudflare's header detection?). Below is the ChatGPT heartbeat that will not be modified again. If robots.txt becomes ineffective in the future, you can modify the link to 404 by yourself. If you think requesting every 5 seconds is too frequent, you can adjust the time interval by yourself.

// ==UserScript==
// @name         ChatGPT heartbeat
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       https://v2ex.com/t/926890
// @match        https://chat.openai.com/chat/*
// @icon         https://chat.openai.com/favicon.ico
// @grant        none
// ==/UserScript==

(function () {
  var iframe = document.createElement("iframe");
  iframe.id = "heartbeat";
  iframe.style = "display:none";
  iframe.name = "heartbeat";
  iframe.src = "https://chat.openai.com/robots.txt";
  var fn = function () {
    setTimeout(function(){
        document.getElementById('heartbeat').contentWindow.location.reload(true);
    }, 5000);
  };
  if (iframe.attachEvent) {
    iframe.attachEvent("onload", fn);
  } else {
    iframe.onload = fn;
  }
  document.body.insertBefore(iframe, document.body.firstChild);
})();
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.