Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

User-Agent Changer - Chrome Extension

A professional Chrome extension that allows you to quickly and easily change your browser's User-Agent string. Perfect for web developers, testers, and users who need to emulate different browsers and devices.

README en espaΓ±ol | Changelog | License

🌟 Key Features

🎯 Quick User-Agent Switching

  • Intuitive popup interface: Fast User-Agent switching with a single click
  • Global and per-tab modes:
    • DEFAULT: Use browser's original User-Agent
    • AUTO: Automatically detect and use the best User-Agent for each site
    • Custom User-Agents: Set specific User-Agents per tab
  • Visual badge system: Shows the active User-Agent alias on the extension icon
    • No badge when DEFAULT is active
    • Custom badge for each User-Agent

πŸ”§ Comprehensive Management Interface

Full-featured options page with multiple sections:

1. Custom User-Agents

  • Add unlimited custom User-Agents
  • Two operation modes:
    • Replace: Completely replaces the browser's User-Agent
    • Append: Adds text to the current User-Agent
  • Customizable badge with:
    • Alias (max 4 characters)
  • Edit and delete custom User-Agents
  • Pre-configured User-Agents included (iPhone 14, Android)

2. Permanent Spoof List

  • Set specific User-Agents for particular domains
  • Supports wildcards: *.example.com, localhost/core/*
  • Automatic application without manual intervention
  • Manage your permanent spoofs list easily

3. Import/Export Settings

  • Export: Save all your settings to a JSON file
    • Custom User-Agents
    • Permanent Spoof List
    • Extension settings
    • Timestamped file names
  • Import: Restore settings from a JSON file
    • Drag & drop support
    • Preview before importing
    • Merge or replace existing settings

4. About & Settings

  • Theme selector (Auto, Light, Dark)
  • Language selector (English, Spanish)
  • Extension information and version
  • Reset functionality
  • Support and contribution links

πŸ›‘οΈ Chrome Special Pages Protection

  • Extension automatically disables on Chrome special pages
  • Prevents modification of protected pages like:
    • chrome:// (Chrome internal pages)
    • chrome-extension:// (Extension pages)
    • edge:// (Edge internal pages)
    • about: (About pages)
  • Clear visual feedback with:
    • Red badge with βœ• symbol
    • Disabled message in popup
    • Security explanation

🌍 Multi-language Support

  • English (en)
  • Spanish (es)
  • Easy to add more languages via JSON locale files

🎨 Theme Support

  • Auto: Follows system preference
  • Light: Light theme
  • Dark: Dark theme
  • Consistent styling across all interfaces

πŸ“¦ Installation

  1. Download or clone this repository
  2. Open Google Chrome and navigate to chrome://extensions/
  3. Enable Developer mode (toggle in the top right corner)
  4. Click Load unpacked
  5. Select the UserAgentChanger project folder
  6. Done! The extension icon will appear in your toolbar

πŸš€ Usage

Quick User-Agent Change:

  1. Click the extension icon in the toolbar
  2. Select one of the options:
    • DEFAULT: Use browser's original User-Agent (global setting)
    • AUTO: Automatic User-Agent detection (global setting)
    • Custom User-Agent: Apply specific User-Agent to current tab
  3. The badge will show the active User-Agent alias
  4. Changes apply immediately

Manage User-Agents:

  1. Click the extension icon
  2. Click "βš™οΈ Manage User-Agents" button
  3. A new tab opens with the full management interface

Add Custom User-Agent:

  1. Go to "Custom User-Agents" section
  2. Fill in the form:
    • Name: Descriptive name (e.g., "iPhone 14 Pro")
    • Alias: Short identifier for badge (max 4 characters)
    • Mode: Choose "Replace" or "Append"
    • User-Agent String: Full User-Agent string
  3. Click "Add User-Agent"

Configure Permanent Spoofs:

  1. Go to "Permanent Spoof List" section
  2. Enter the domain pattern (e.g., *.google.com, localhost/*)
  3. Select the User-Agent to apply
  4. Click "Add Permanent Spoof"
  5. The spoof will apply automatically to matching domains

Import/Export Settings:

  1. Go to "Import/Export Settings" section
  2. To Export:
    • Click "Click Here To Download"
    • Save the JSON file with your settings
  3. To Import:
    • Select a JSON file or drag & drop it
    • Preview the settings before importing
    • Choose to merge or replace existing settings
    • Confirm the import

πŸ“ Project Structure

UserAgentChanger/
β”œβ”€β”€ manifest.json                    # Extension configuration
β”œβ”€β”€ popup.html                       # Popup HTML
β”œβ”€β”€ options.html                     # Options page HTML
β”œβ”€β”€ generate_icons.html              # Icon generator utility
β”œβ”€β”€ README.md                        # This file (English)
β”œβ”€β”€ README_ES.md                     # Spanish README
β”œβ”€β”€ CHANGELOG.md                     # Version history
β”œβ”€β”€ LICENSE                          # MIT License
β”œβ”€β”€ LICENSE_ES.md                    # Spanish license
β”œβ”€β”€ PRIVACY_POLICY.md                # Privacy Policy (English)
β”œβ”€β”€ PRIVACY_POLICY_ES.md             # Privacy Policy (Spanish)
β”œβ”€β”€ _locales/                        # Internationalization
β”‚   β”œβ”€β”€ en/
β”‚   β”‚   └── messages.json           # English translations
β”‚   └── es/
β”‚       └── messages.json           # Spanish translations
β”œβ”€β”€ css/                            # Stylesheets
β”‚   β”œβ”€β”€ commons.css                 # Common styles
β”‚   β”œβ”€β”€ popup.css                   # Popup styles
β”‚   β”œβ”€β”€ theme.css                   # Theme variables
β”‚   └── options/                    # Options page styles
β”‚       β”œβ”€β”€ about.css
β”‚       β”œβ”€β”€ cards.css
β”‚       β”œβ”€β”€ forms.css
β”‚       β”œβ”€β”€ header.css
β”‚       β”œβ”€β”€ import-export.css
β”‚       └── layout.css
β”œβ”€β”€ icons/                          # Extension icons
β”‚   β”œβ”€β”€ icon16.png
β”‚   β”œβ”€β”€ icon32.png
β”‚   β”œβ”€β”€ icon48.png
β”‚   β”œβ”€β”€ icon128.png
β”‚   β”œβ”€β”€ icon256.png
β”‚   └── logo.png
└── js/                             # JavaScript files
    β”œβ”€β”€ background.js               # Main background service worker
    β”œβ”€β”€ background-badge.js         # Badge management
    β”œβ”€β”€ background-listeners.js     # Event listeners
    β”œβ”€β”€ background-permanentSpoofs.js # Permanent spoofs logic
    β”œβ”€β”€ background-userAgent.js     # User-Agent application
    β”œβ”€β”€ popup.js                    # Popup logic
    β”œβ”€β”€ options.js                  # Options page logic
    β”œβ”€β”€ common-constants.js         # Shared constants
    β”œβ”€β”€ common-i18n.js              # Internationalization
    β”œβ”€β”€ common-messaging.js         # Inter-component communication
    β”œβ”€β”€ common-notify.js            # Notification system
    β”œβ”€β”€ common-storage.js           # Storage utilities
    β”œβ”€β”€ common-ua.js                # User-Agent utilities
    β”œβ”€β”€ common-utils.js             # General utilities
    β”œβ”€β”€ common-validations.js       # Input validations
    └── common-version.js           # Version management

πŸ”§ Technologies Used

  • Manifest V3: Latest Chrome extension system
  • declarativeNetRequest API: For modifying HTTP request headers
  • Chrome Storage API: For persisting configurations
  • Chrome Badge API: For showing indicators on the icon
  • Chrome Tabs API: For per-tab User-Agent management
  • HTML5/CSS3/JavaScript: Modern and responsive interface
  • CSS Custom Properties: Dynamic theming
  • Internationalization API: Multi-language support

βš™οΈ Required Permissions

This extension requires the following permissions to function properly:

Chrome API Permissions:

  • declarativeNetRequest

    • Purpose: Allows the extension to modify HTTP request headers
    • Why needed: Essential for changing the User-Agent header in web requests. This API enables the extension to intercept and modify the User-Agent string before requests are sent to servers.
  • activeTab

    • Purpose: Grants temporary access to the currently active tab when you interact with the extension
    • Why needed: Allows the extension to apply User-Agent changes to the tab you're currently viewing when you use the popup. This is a privacy-friendly permission that only works when you explicitly click the extension icon.
    • Security benefit: Unlike broad permissions, activeTab only grants access when you actively use the extension, ensuring maximum privacy and security.
  • storage

    • Purpose: Provides access to Chrome's storage API
    • Why needed: Stores all extension configurations locally, including:
      • Custom User-Agent definitions
      • Permanent spoof list
      • User preferences (theme, language)
      • Badge colors and settings
      • Active User-Agent state per tab
  • tabs

    • Purpose: Allows interaction with browser tabs
    • Why needed: Required for:
      • Detecting when tabs are created, updated, or removed
      • Managing per-tab User-Agent settings
      • Updating the badge on the extension icon for each tab
      • Opening the options page in a new tab
      • Detecting Chrome special pages to disable the extension
  • scripting

    • Purpose: Provides access to Chrome's scripting API
    • Why needed: Enables advanced functionality for:
      • Dynamic content interaction if needed
      • Future feature enhancements
      • Improved compatibility with web pages

Security & Privacy Notes:

  • Minimal permissions: Uses activeTab instead of broad host permissions for enhanced privacy
  • Chrome Web Store compliant: Follows best practices for extension permissions
  • Always up-to-date User-Agent: Automatically uses the browser's current User-Agent (obtained from Service Worker) as the base, ensuring compatibility without hardcoded values
  • Local storage only: All data is stored locally using Chrome's storage API
  • No external communication: No data is transmitted to external servers
  • Header-only modification: The extension only modifies User-Agent headers, not page content
  • Automatic protection: Prevents modifications on Chrome special pages (chrome://, edge://, etc.)

πŸ’‘ Use Cases

  1. Web Development: Test how your site looks on different devices
  2. Testing: Verify User-Agent-specific behavior
  3. Web Scraping: Simulate different browsers or devices
  4. Privacy: Modify your browser fingerprint
  5. Content Access: Some sites show different content based on device
  6. Automation: Set permanent spoofs for specific development environments
  7. API Testing: Test API responses for different User-Agents

πŸ›‘οΈ Privacy & Security

  • All data is stored locally in your browser
  • No information is sent to external servers
  • No browsing data is collected
  • Open source and auditable
  • Automatic protection on Chrome special pages
  • Respects browser security restrictions

πŸ“ Technical Notes

  • User-Agent applies to all HTTP/HTTPS requests
  • Changes are immediate without needing to reload tabs
  • "Append" mode uses the current Chrome User-Agent as base
  • DEFAULT mode shows no badge on icon
  • Permanent spoofs take precedence over global settings
  • Extension is disabled on Chrome special pages for security

🌐 Supported Browsers

  • Google Chrome (Chromium-based browsers)
  • Microsoft Edge
  • Brave
  • Opera
  • Any Chromium-based browser supporting Manifest V3

πŸ‘¨β€πŸ’» Author

Trystan4861

🀝 Contributing

Contributions are welcome! If you find a bug or have a suggestion:

  1. Open an issue on the GitHub repository
  2. If you want to contribute code, fork the repository and create a pull request
  3. Follow the existing code style and conventions
  4. Add appropriate tests for new features
  5. Update documentation as needed

Development Setup

  1. Clone the repository
  2. Make your changes
  3. Test in Chrome by loading the unpacked extension
  4. Submit a pull request with a clear description

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ†˜ Support

If you have problems or questions:

  • Check that the extension is enabled in chrome://extensions/
  • Verify you have sufficient permissions
  • Check the extension's error console
  • Review closed issues for similar problems
  • Open a new issue if needed

🎯 Roadmap

Future features under consideration:

  • More pre-configured User-Agents
  • User-Agent templates
  • Statistics and usage tracking
  • Cloud sync (optional)
  • Browser detection improvements
  • Additional language support
  • Custom User-Agent rotation
  • Advanced filtering options

Developed with ❀️ to facilitate web development and testing.

Star ⭐ this repository if you find it useful!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages