Currently it is possible to clear all messages with the scriptlet


but I prefer having a specific in-page button or command (e.g. /clear).

(Added): It could look like this:


and would allow users to get rid of things they don't care for (e.g., funny gifs they don't find funny) without resorting to flags or arguments.

  • 3
    Why would you want to remove all of the previous context of the current conversations? – jjnguy Aug 6 '10 at 19:22

We're never to old for userscripts right?

// ==UserScript==
// @name         Clear Chat Button
// @namespace    http://your.homepage/
// @version      1.0
// @description  Nukes everything in chat
// @author       UniKitty
// @match        http://chat.stackexchange.com/rooms/*
// @match        http://chat.meta.stackexchange.com/rooms/*
// @match        http://chat.stackoverflow.com/rooms/*
// @grant        none
// ==/UserScript==

function go() {
    var clearButton = document.createElement('button');
    clearButton.setAttribute("class", "button");
    clearButton.setAttribute("id", "clear-chat");
    clearButton.innerHTML = "Clear Chat";
    clearButton.addEventListener("click", function() {
      if (confirm('Are you sure you want to clear the messages?')) {
        document.getElementById('chat').style.display = "none";

    var showButton = document.createElement('button');
    showButton.setAttribute("class", "button");
    showButton.setAttribute("id", "show-chat");
    showButton.innerHTML = "Refresh Chat";
    showButton.addEventListener("click", function() {
      document.getElementById('chat').style.display = "";

    var chatButtonContainer = document.getElementById('chat-buttons');


This adds in a button to chat:
enter image description here
When you click it, there's a poopup asking for confirmation.enter image description here

And boom! Everything is gone!enter image description here

To install it, just copy the text into a file and save it as something.user.js. Then install something like greasemonkey and drag the file into firefox (or chrome). Then install the userscript!
Sound effects not included


The whole point of the chat is to show "saved state" of the room every time you enter.

If we wanted busted old statelessness, we'd use IRC, no?

  • I don't mean statelessness on the server side, but that after user has read every old messages, can clear the chat area on the client side so that it's easier to spot what's new. Think the IRC /clear command. – kennytm Aug 7 '10 at 6:52
  • @kennytm the dotted line tells you this per the /faq – Jeff Atwood Aug 7 '10 at 7:02
  • Except the user can't decide where the line is put. At least for me, the system often put the line too old than where I finished. – kennytm Aug 7 '10 at 9:03
  • how is the line location chosen? – lathomas64 Aug 11 '10 at 19:16
  • 1
    If you are used to IRC though it would be nice to have a similar feature to clear the previous posts from the browser, it doesn't need to affect other users, just clear your view. – kamui Nov 24 '11 at 14:51
  • 3
    There is a damn good reason for a /clear: People posting pictures of Justin Bieber in the chat. – ThiefMaster Jun 25 '12 at 16:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .