Disable the context menu in JavaScript PDF Viewer
16 Oct 20251 minute to read
Set ContextMenuOption to None to hide all context menu options. The default value is RightClick.
Example: Disable context menu
<button id='disable'>Disable ContextMenuOption</button>
// Disable ContextMenuOption
document.getElementById('disable').addEventListener('click', ()=> {
viewer.contextMenuOption = 'None';
});This hides the context menu and prevents right-click interactions in the viewer.
Sample: How to disable the context menu