📜 ⬆️ ⬇️

Firefox Home Button

Hello! I recently wanted to make a button in the toolbar, clicking on which my browser would move me to the main site. Many will say “Why? Are there links on sites? ”. And I'm too lazy to look for them, and the honest word “I WANT A BUTTON” to button in a permanent place!

It is NOT dedicated to all javascript ʻupliers - they will write it without problems, but how to be a regular user who does not know how, but really needs it?

And I need such a button ....
')
I apologize for the offtopic, but immediately I want to draw attention habralyuda! This article is written for ordinary users. She in no way claims to be unique. Code optimization was not and will not be! (AS IS)

Go!

For a start, we will need the Custom Buttons addon.

After installing the add-on, you must restart the browser.

Next, add a button to the browser toolbar: right click on the toolbar -> add a button

image

In the field "Name:" enter the name of the button.
In the “Code” field we enter the javascript of our button (choose the most convenient for yourself):

The URL will open in a new tab.


// -
var main_link = gBrowser.contentDocument.location.host;

//
gBrowser.selectedTab = gBrowser.addTab(main_link);


The URL will open in the same tab.
(CTRL + Click_to_button = URL in a new tab)

// -
var main_link = gBrowser.contentDocument.location.host;

// URL
openUILink(main_link, event, false, true);

Choose a card on the button and voila!

Result:
image

Thank:
Ionicman - for the habr-article "How to make FF more convenient - we write our buttons"

Spec Thank you:
classx - for a link to the addon “Homepage plugin” , which makes the “Home” button work the same way
remal - for a tip on the function "location.host"

Source: https://habr.com/ru/post/99206/


All Articles