How can I prevent a user accessing the Library pop-up (Ctrl+Shift+o)
I am using Firefox as a multi-tab courseware viewer but need to block the user bringing up the Library page as then the user can see the courseware URL's - I am running it on AWS AppStream and can lock most features down., but this one eludes me - there seems to be no policy to block it. I have tried intercepting keystrokes at the GNOME level and autoconfig javascript to block keys. Is there a way to do this please? Blessings, Ian
Toate răspunsurile (5)
You can change or even clear it on about:keyboard.
Can I do this programmatically? Where do the settings get stored please?
Use this in your autoconfig (firefox.cfg): // Block Library page (Ctrl+Shift+O) Services.obs.addObserver((win) => {
if (win.location.href.includes("places.xhtml")) win.close();
}, "domwindowopened", false); That’s the most reliable way on AppStream. If you want it even stronger, also hide the menu item with userChrome.css and globally block the hotkey at GNOME level. This should do it.
In the end I did this by:
- Added an event listener in an extension with the code:
// =========================================================================
// 1. KEYBOARD LOCKDOWN
// =========================================================================
const ALLOWED_KEYS = [
// New contexts
{ key: "f", ctrl: true, description: "Find" },
{ key: "r", ctrl: true, description: "Reload" }
];
window.addEventListener("keydown", function (e) {
for (const rule of ALLOWED_KEYS) {
if (
e.key === rule.key &&
!!rule.ctrl === e.ctrlKey &&
!!rule.shift === e.shiftKey &&
!!rule.alt === e.altKey &&
!!rule.meta === e.metaKey
) {
return;
}
}
if (e.ctrlKey || e.altKey) {
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
return false;
}
}, true);
- Added to my userChrome.css:
/* Hide the Library Window Content (Bookmarks/History Manager) */
window#placesContext,
window#places {
display: none !important; visibility: hidden !important;
}
I'm investigating making some aspect of about:keyboard available to policy.
I'd love to talk more about what you're doing though.
Would you mind reaching out directly?
mkaply at mozilla.com