Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Remove entries from firefox right click menu for images [or anything really]

  • 7 回覆
  • 1 有這個問題
  • 94 次檢視
  • 最近回覆由 cor-el

more options

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

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

被選擇的解決方法

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:

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:

從原來的回覆中察看解決方案 👍 0

所有回覆 (7)

more options

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.

more options

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

由 Haruna 於 修改

more options

Thanks, Haruna. And what are the rules for the menu modifications?

more options

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.

more options

選擇的解決方法

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:

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:

more options

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

more options

You're welcome.