Remove entries from firefox right click menu for images [or anything really]
I've seen people giving examples of css code that you need to use to do this but when I tried adding those things to the userChrome file that I already use it didn't actually remove anything from the right click image menu at all. Can someone please explain in simple terms how to remove these entries from the right click menu... 'Open link in new window', 'Open link in new private window', 'Save link to pocket', 'Email image', 'View image info', 'Send link to device', 'Inspect element', 'Inspect Accessibility Properties'. Thanks
Izabrano rješenje
See this file for the IDs of various context menu items:
You can add code to the userChrome.css file below the default @namespace line.
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */ #context-openlink, #context-openlinkprivate, #context-savelinktopocket, #context-sendimage, #context-viewimageinfo, #context-sendlinktodevice, #context-inspect, #context-inspect-a11y { display:none!important; }
It is not that difficult to create userChrome.css if you have never used it.
The first step is to open the "Help -> Troubleshooting Information" page and find the button to access the profile folder.
You can find this button under the "Application Basics" section as "Profile Folder -> Open Folder". If you click this button then you open the profile folder in the Windows File Explorer. You need to create a folder with the name chrome in this folder (name is all lowercase). In the chrome folder you need to create a plain text file with the name userChrome.css (name is case sensitive). In this userChrome.css text file you paste the text posted. On Mac you can use the TextEdit utility to create the userChrome.css file as a plain text file.
In Windows saving the file is usually the only time things get more complicated because Windows can silently add a .txt file extension and you end up with a file named userChrome.css.txt. To avoid this you need to make sure to select "All files" in the dialog to save the file in the text editor using "Save File as".
You need to close (Quit/Exit) and restart Firefox when you create or modify the userChrome.css file.
See also:
- https://www.userchrome.org/what-is-userchrome-css.html
- https://www.userchrome.org/how-create-userchrome-css.html
In Firefox 69 and later you need to set this pref to true on the about:config page to enable userChrome.css and userContent.css in the chrome folder.
- toolkit.legacyUserProfileCustomizations.stylesheets = true
See:
Pročitaj ovaj odgovor u kontekstu 👍 0Svi odgovori (7)
Hi Haruna, what is the code you're working with? If you post it here, please use <pre> before and </pre> after it to minimize misinterpretation by the forum software. Otherwise, you can share it on Pastebin, as a Github Gist, etc.
Hi jscher2000, Thanks a lot for the reply. The userChrome file I have is for things like Tabs on bottom and Toolbar sizes etc.
#urlbar-wrapper { height: 36px !important; } #personal-bookmarks .bookmark-item > .toolbarbutton-icon { height:28px !important; width:24px !important; } #nav-bar toolbarspring { min-width: 15px !important; max-width: 30px !important; } #navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):-moz-lwtheme { background: initial !important; } #nav-bar:-moz-lwtheme { box-shadow: initial !important; } /* ACTIVE TAB MODIFICATIONS */ /* No background color on selected tab */ #main-window[lwthemetextcolor="bright"] #tabbrowser-tabs:not([movingtab]) > .tabbrowser-tab > .tab-stack > .tab-background[selected=true]:-moz-lwtheme { background-image: none !important; } /* Underline active tab title text for visibility */ #main-window[lwthemetextcolor="bright"] #tabbrowser-tabs:not([movingtab]) > .tabbrowser-tab[selected=true] { text-decoration: underline !important; } /* No top line on selected tab */ #main-window[lwthemetextcolor="bright"] .tabbrowser-tab[selected="true"] .tab-line { display: none !important; } /* TABS: on bottom */ #navigator-toolbox toolbar:not(#nav-bar):not(#toolbar-menubar) {-moz-box-ordinal-group:10} #TabsToolbar {-moz-box-ordinal-group:1000!important} #TabsToolbar { position: absolute !important; bottom: 0 !important; width: 100vw !important; display: block !important; } #tabbrowser-tabs { top: 300 !important; width: 100vw !important; } #main-window:not([chromehidden*="toolbar"]) #navigator-toolbox { padding-bottom: calc(1px + var(--tab-min-height_tnot)) !important; } /* TABS: height */ :root { --tab-toolbar-navbar-overlap: 0px !important; --tab-min-height: 33px !important; /* adjust to suit your needs */ --tab-min-height_tnot: 32px; } :root #tabbrowser-tabs { --tab-min-height: 33px !important; /* needs to be the same as above under :root */ --tab-min-width: 80px !important; } #TabsToolbar { height: var(--tab-min-height) !important; margin-bottom: 1px !important; box-shadow: ThreeDShadow 0 -1px inset, -moz-dialog 0 1px !important; background-color: var(--toolbar-bgcolor) !important; } /* hide windows-controls */ #TabsToolbar #window-controls {display:none!important;} /* move caption buttons to right of Tab bar */ #main-window[tabsintitlebar]:not([inFullscreen="true"]) #toolbar-menubar[autohide="true"] ~ #TabsToolbar .titlebar-buttonbox-container { position: fixed !important; right: 0 !important; top: calc(6px + var(--tab-min-height)) !important; display: block !important; visibility: visible !important; } #toolbar-menubar[autohide="true"] ~ #TabsToolbar {padding-right: 100px !important;}
I just copy/pasted all this ages ago from somewhere,and then edited the sizes etc a bit and it does exactly what I wanted. I tried to add things to remove menu items that I saw on different forums but I really don't know what I'm doing :)
Thanks
Izmjenjeno
Thanks, Haruna. And what are the rules for the menu modifications?
Hi,do you mean what items I want to remove from the menu? I've never used any of these and with a few addons the menu is becoming very long and cluttered.
'Open Link In New Window', 'Open Link In New Private Window', 'Save Link To Pocket', 'Email Image', 'View Image Info', 'Send Link To Device', 'Inspect Element', 'Inspect Accessibility Properties'
Thanks a lot.
Odabrano rješenje
See this file for the IDs of various context menu items:
You can add code to the userChrome.css file below the default @namespace line.
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */ #context-openlink, #context-openlinkprivate, #context-savelinktopocket, #context-sendimage, #context-viewimageinfo, #context-sendlinktodevice, #context-inspect, #context-inspect-a11y { display:none!important; }
It is not that difficult to create userChrome.css if you have never used it.
The first step is to open the "Help -> Troubleshooting Information" page and find the button to access the profile folder.
You can find this button under the "Application Basics" section as "Profile Folder -> Open Folder". If you click this button then you open the profile folder in the Windows File Explorer. You need to create a folder with the name chrome in this folder (name is all lowercase). In the chrome folder you need to create a plain text file with the name userChrome.css (name is case sensitive). In this userChrome.css text file you paste the text posted. On Mac you can use the TextEdit utility to create the userChrome.css file as a plain text file.
In Windows saving the file is usually the only time things get more complicated because Windows can silently add a .txt file extension and you end up with a file named userChrome.css.txt. To avoid this you need to make sure to select "All files" in the dialog to save the file in the text editor using "Save File as".
You need to close (Quit/Exit) and restart Firefox when you create or modify the userChrome.css file.
See also:
- https://www.userchrome.org/what-is-userchrome-css.html
- https://www.userchrome.org/how-create-userchrome-css.html
In Firefox 69 and later you need to set this pref to true on the about:config page to enable userChrome.css and userContent.css in the chrome folder.
- toolkit.legacyUserProfileCustomizations.stylesheets = true
See:
Hi cor-el,thanks a lot for the reply and explanation.
I've just added that to the existing userChrome file and it worked perfectly after restarting Firefox.
Thanks very much cor-el and jscher2000,I really appreciate your help.
Haruna
You're welcome.