Google-chrome – Disable “Back” in Chrome’s context menu

context menugoogle-chrome

I'm using chrome and like to right click links, then select 'Open in new tab'. If I slightly mis-click, the regular context menu opens instead, and as its top item is 'Back', such occurs, much to my annoyance.

If 'Back' and 'Forward' were switched, so the top item were 'Forward' (thus most of the time disabled), this would not be a problem. I'd also be happy to remove 'Back' altogether.

Ctrl+click is not a solution as it requires two hands, which I do not always want to spare (e.g. when busy facepalming). Middle click is a solution, but a bit cumbersome, and I would prefer to instead customize the browser.

Best Answer

The Chrome context-menu cannot be edited to remove items, even by an extension. This is the way that the API is defined at chrome.contextMenus. An extension may only remove additional entries that it created, so no extension can remove the built-in entries.

The only solution would be to block the Back action itself.

Method 1 : Tampermonkey extension - JavaScript injection

One way of disabling the Back function is by by injecting JavaScript code into all web pages, by using the Tampermonkey extension.

The JavaScript code to inject is (source):

<script type = "text/javascript" >
    history.pushState(null, null, location.href);
    history.back();
    history.forward();
    window.onpopstate = function () {
        history.go(1);
    };
</script>

For information on using Tampermonkey, see for example:
How to Inject Scripts to Websites Using TamperMonkey.

Method 2 : No History extension

Another helpful extension is the No History extension.

This extension disables history and therefore also the possibility of doing Back. Even the Back button is disabled.

The extension can be toggled On and Off, and its drawback is that you will not have any history while it is On.

Related Question