Appearance
Disable Inspect Plugin
File Information
- Path:
plugins/disable-inspect.js - Purpose: Disables browser developer tools in production
Overview
The Disable Inspect plugin prevents users from accessing browser developer tools in production environments. It disables the right-click context menu and can optionally disable keyboard shortcuts for developer tools. This provides basic protection against casual inspection of the application.
Key Features
Context Menu Disable
- Prevents right-click menu
- Production only
- Client-side only
Optional Keyboard Shortcuts
- F12 disable (commented)
- Ctrl+Shift+I disable (commented)
- Ctrl+U disable (commented)
Configuration
The plugin only runs when:
process.client- Browser environmentprocess.env.APP_ENV === 'production'- Production mode
Usage
The plugin runs automatically in production:
- No configuration needed
- Automatically disables context menu
- Keyboard shortcuts disabled (if uncommented)
Security Note
Important: This plugin provides only basic protection:
- Determined users can still access dev tools
- Not a security measure
- Mainly prevents casual inspection
- Can be bypassed
Code Structure
javascript
// Disables right-click context menu
document.addEventListener('contextmenu', (event) => {
event.preventDefault()
})
// Optional: Disable keyboard shortcuts (commented)
// F12, Ctrl+Shift+I, Ctrl+UWhen to Use
- Production environments
- When you want to discourage inspection
- Basic content protection
- Not for security-critical applications
Notes for Development
- Plugin only runs in production
- Client-side only
- Basic protection only
- Can be bypassed
- Not a security feature
Related Documentation
- Nuxt.js Environment Variables - Environment config