---
title: Adopting Declarative Content Blocking in Safari Web Extensions
framework: safariservices
role: sampleCode
role_heading: Sample Code
path: sample-code/safariservices/adopting-declarative-content-blocking-in-safari-web-extensions
---

# Adopting Declarative Content Blocking in Safari Web Extensions

Block web content with your web extension using the declarative net request API.

## Overview

Overview note: This sample code project is associated with WWDC21 session 10027: Explore Safari Web Extension Improvements. Configure the Sample Code Project Before you run the sample code project in Xcode: On macOS: Open Safari and choose Develop > Allow Unsigned Extensions. In the project settings in Xcode, select the Blocker (macOS) target. Click the Signing & Capabilities tab. For Signing Certificate, choose Sign to Run Locally. (Leave Team set to None.) Repeat steps 3 and 4 for the Blocker Extension (macOS) target. On iOS, to run on a device: In the project settings in Xcode, select the Blocker (iOS) target. Click the Signing & Capabilities tab. Select a development team. Repeat the above steps for the Blocker Extension (iOS) target.

## See Also

### Blocking content

- [Blocking content with your Safari web extension](safariservices/blocking-content-with-your-safari-web-extension.md)
