Skip to content

Instantly share code, notes, and snippets.

Last active October 3, 2022 18:27
Show Gist options
  • Save Sporif/ad6e917d87787491538bac80d3c8918c to your computer and use it in GitHub Desktop.
Save Sporif/ad6e917d87787491538bac80d3c8918c to your computer and use it in GitHub Desktop.
Restart Button for Firefox. An updated version of Middle click also empties the script cache.
(function() {
if (location != 'chrome://browser/content/browser.xul' && location != 'chrome://browser/content/browser.xhtml')
try {
id: 'restart-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
var toolbaritem = aDocument.createElementNS('', 'toolbarbutton');
toolbaritem.onclick = event => onClick(event);
var props = {
id: 'restart-button',
class: 'toolbarbutton-1 chromeclass-toolbar-additional',
label: 'Restart',
tooltiptext: 'Restart (with middle click userChrome.js cache is emptied)',
style: 'list-style-image: url(chrome://browser/skin/sync.svg)'
for(var p in props)
toolbaritem.setAttribute(p, props[p]);
return toolbaritem;
} catch(e) {};
function onClick(event) {
if(event.button == 1)
else if(event.button == 2)
let cancelQuit = Cc[";1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
Copy link

@rpolo77 and @you74674

Firefox 82.02

I followed the instructions.

Save config.js to Firefox installation folder, next to firefox.exe
Save config-prefs.js into \defaults\pref inside Firefox installation folder, next to channel-prefs.js
Save userChrome.js into Firefox chrome folder, next to userChrome.css
and it works

Also moved RestartFirefoxButton_Movable.uc.js to the chrome folder, but the button does not appear.

Is this still supposed to work, or am I missing something? Can someone post what the button looks like?

Copy link

ghost commented Nov 5, 2020

Did you go to Customize and add the button to your toolbar area?

Copy link

siffegh commented Nov 5, 2020

Button looks like this:

Copy link

nollinvoyd commented Nov 8, 2020

Guess what? I didn't have RestartFirefoxButton_Movable.uc.js in the Chrome folder after all. Dumb.

So happy. Works fine. Been hoping to find this type of restart option for a long time now.

In past custom button setups, it was possible to source the button image from a local file. I still have the previous RestartFirefoxButton_Movable.uc.js. The section of that file pertaning to the button starts with

var dataUrl = "data:image/png;base64," +

after which the base 64 code is added.

Can someone tell me if this can be done, and if so, how?


Copy link

I just upgraded to Firefox 89, and the restart button icon changed

Firefox 88.01


Firefox 89


Is there a way to bring it back?

Copy link

Chirunos commented Sep 8, 2022

It doesn't work :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment