Ad Blocker

A Technical Case Study in Chrome Extension Development with Manifest V3

A comprehensive online directory for all immigration programs and portfolio management services for Indian HNIs.

This case study explores the design and development of SundayPyjamas Adblocker, a Chrome extension built using Manifest V3 for private and efficient ad blocking. It delves into the technical aspects of the extension, highlighting its use of declarative rules and service workers to achieve a lightweight and privacy-focused solution.

Technology Stack

Chrome Manifest V3: The latest version of Chrome's extension architecture, providing a more secure and efficient platform for developing extensions.

DeclarativeNetRequest API: An API that allows extensions to define rules for blocking network requests based on domain patterns, making it efficient for ad blocking.

Service Workers: A type of background script that enables extensions to perform tasks in the background without a persistent connection, improving performance and resource usage.

JavaScript: The primary programming language used to implement the extension's functionality.

The redesigned Taiyo Solar website was built using:

  • Frontend: React.js

  • Backend: Node.js with Express.js

  • Database: MongoDB

  • Content Management System: Strapi (Headless CMS)

  • Hosting: Amazon Web Services (AWS)

The redesigned Taiyo Solar website was built using:

  • Frontend: React.js

  • Backend: Node.js with Express.js

  • Database: MongoDB

  • Content Management System: Strapi (Headless CMS)

  • Hosting: Amazon Web Services (AWS)

The redesigned Taiyo Solar website was built using:

  • Frontend: React.js

  • Backend: Node.js with Express.js

  • Database: MongoDB

  • Content Management System: Strapi (Headless CMS)

  • Hosting: Amazon Web Services (AWS)

Problem Statement

The pervasive presence of online advertisements disrupts user experience and raises privacy concerns. Tracking scripts embedded within ads often collect user data without explicit consent, compromising privacy and potentially leading to targeted advertising practices.  

Challenges

  • Responsive Design: Ensuring the website functions well across various devices and screen sizes is crucial, given the diverse audience of renewable energy companies.

  • Performance Optimization: Balancing rich content with fast load times is challenging but essential for user retention.

  • Navigation and Information Architecture: Organizing complex information in an easily navigable structure is crucial for user experience

Technical Architecture

The core components of the extension include:

  • manifest.json: Defines the extension's properties, permissions, and structure.  

  • background.js: A service worker script containing the core ad blocking logic.

  • icons: Extension icon displayed in the Chrome toolbar.

The extension utilizes service workers as lightweight background scripts, promoting efficient resource utilization. Manifest V3's declarativeNetRequest API allows for defining rules that match and block network requests to specific domains associated with ad serving and tracking. This eliminates the need for a persistent background page, further enhancing resource efficiency.  

The core components of the extension include:

  • manifest.json: Defines the extension's properties, permissions, and structure.  

  • background.js: A service worker script containing the core ad blocking logic.

  • icons: Extension icon displayed in the Chrome toolbar.

The extension utilizes service workers as lightweight background scripts, promoting efficient resource utilization. Manifest V3's declarativeNetRequest API allows for defining rules that match and block network requests to specific domains associated with ad serving and tracking. This eliminates the need for a persistent background page, further enhancing resource efficiency.  

The core components of the extension include:

  • manifest.json: Defines the extension's properties, permissions, and structure.  

  • background.js: A service worker script containing the core ad blocking logic.

  • icons: Extension icon displayed in the Chrome toolbar.

The extension utilizes service workers as lightweight background scripts, promoting efficient resource utilization. Manifest V3's declarativeNetRequest API allows for defining rules that match and block network requests to specific domains associated with ad serving and tracking. This eliminates the need for a persistent background page, further enhancing resource efficiency.  

The core components of the extension include:

  • manifest.json: Defines the extension's properties, permissions, and structure.  

  • background.js: A service worker script containing the core ad blocking logic.

  • icons: Extension icon displayed in the Chrome toolbar.

The extension utilizes service workers as lightweight background scripts, promoting efficient resource utilization. Manifest V3's declarativeNetRequest API allows for defining rules that match and block network requests to specific domains associated with ad serving and tracking. This eliminates the need for a persistent background page, further enhancing resource efficiency.  

Key Technologies

Chrome Manifest V3: The latest extension architecture from Chrome, prioritizing security, privacy, and performance through declarative APIs and service worker usage.

DeclarativeNetRequest API: Enables efficient ad blocking by defining rules for matching and blocking network requests based on domain patterns.

Service Workers: Lightweight background scripts that execute in the background without a persistent connection, improving resource utilization.

Implementation Details

The background script (background.js) likely utilizes the declarativeNetRequest API to create rules that block requests to the predefined list of ad and tracking domains listed in the manifest.json file. This approach offers a declarative and efficient way to block unwanted content without the need for complex, custom JavaScript code.

Future Development

Deepening Focus on JavaScript

While the core ad blocking functionality of SundayPyjamas Adblocker is likely implemented using declarative rules, JavaScript can play a significant role in enhancing the extension's capabilities and user experience. Here are some potential areas to explore:

  • Customizable Blocking Rules

  • Advanced Filtering Options

  • Performance Optimization:

  • Integration with Other Tools