A Safari Web Extension that automatically redirects YouTube URLs to their privacy-enhanced embed versions using youtube-nocookie.com, eliminating tracking cookies and protecting your privacy.
FreeYT intercepts YouTube links and redirects them to embed-only versions that don't set tracking cookies. This happens at the network level using Safari's declarativeNetRequest API, making it fast, reliable, and battery-efficient.
- Network-level URL redirection (no DOM manipulation)
- Safari-only extension (explicit guard for non-Safari user agents)
- Supports multiple YouTube URL formats:
- youtube.com/watch?v=xxx
- youtu.be/xxx
- youtube.com/shorts/xxx
- m.youtube.com (mobile)
- Toggle extension on/off via Safari toolbar popup with Liquid Glass styling
- Persistent state across browser sessions
- Dark/light mode support in popup UI
- Native iOS/Mac host app with modern SwiftUI interface (Liquid Glass design, morph-ready containers, animated background/particles, haptics, tint picker)
- No data collection, no tracking, no analytics
- Manifest V3: Modern Safari Web Extension API
- declarativeNetRequest: Network-level URL rewriting for performance
- Background Service Worker: Manages rule enabling/disabling
- chrome.storage: Persists user toggle preferences
- Safari Toolbar Popup: User interface for extension control
- User navigates to a YouTube URL
- Safari intercepts the request via declarativeNetRequest
- If extension is enabled, applies regex pattern matching
- Redirects to youtube-nocookie.com/embed/[video-id]
- Video plays without tracking cookies
-
Clone or download this repository
-
Open the project in Xcode:
open FreeYT.xcodeproj
-
Build the project:
xcodebuild -project FreeYT.xcodeproj -scheme FreeYT \ -destination 'platform=iOS Simulator,name=iPhone 16' buildOr press Command+R in Xcode
-
Enable the extension in Safari:
- Open Safari > Settings > Extensions
- Find "FreeYT - Privacy YouTube"
- Toggle it ON
- Grant permissions for youtube.com
- Click the FreeYT icon in Safari's toolbar
- Use the toggle switch to enable or disable redirects
- Status indicator shows current state:
- Green: Extension active
- Gray: Extension disabled
The popup includes test buttons to verify functionality:
- Click "Test: YouTube Video" to open a sample video link
- Click "Test: YouTube Short" to open a sample short link
- Both should redirect to youtube-nocookie.com if enabled
Visit any YouTube URL:
- https://www.youtube.com/watch?v=dQw4w9WgXcQ
- https://youtu.be/dQw4w9WgXcQ
- https://www.youtube.com/shorts/abc123
All should redirect to their youtube-nocookie.com embed equivalents.
FreeYT/
├── FreeYT.xcodeproj # Xcode project file
├── FreeYT/ # Host application
│ ├── AppDelegate.swift # App lifecycle management
│ ├── SceneDelegate.swift # Scene configuration
│ ├── LiquidGlassView.swift # Main app screen (modern SwiftUI)
│ ├── LiquidGlassHostingController.swift # UIHostingController wrapper
│ ├── Info.plist # App bundle configuration
│ ├── Assets.xcassets/ # Icons and images
│ └── LaunchScreen.storyboard # Splash screen
└── FreeYT Extension/ # Safari Web Extension
├── Resources/
│ ├── manifest.json # Extension configuration
│ ├── rules.json # URL redirect rules
│ ├── background.js # Service worker
│ ├── popup.html # Toolbar popup UI
│ ├── popup.css # Popup styling
│ ├── popup.js # Popup logic
│ └── images/ # Extension icons
└── Info.plist # Extension bundle configuration
Defines extension permissions, background worker, toolbar action, and declarativeNetRequest rules.
Contains regex patterns for matching and redirecting YouTube URLs. All redirect rules use priority 1 and apply to youtube.com domains.
Service worker that:
- Initializes extension as enabled by default
- Listens for toggle changes from popup
- Enables/disables redirect rulesets dynamically
- Logs all state changes for debugging
Safari toolbar popup interface that:
- Displays current extension state
- Provides toggle control (Safari-only guard; blocks non-Safari)
- Includes test buttons for verification
- Supports system dark/light mode
Modern SwiftUI app UI that:
- Displays app branding with Liquid Glass design, animated background/particles
- Shows extension status and instructions in a GlassEffectContainer cluster
- Includes morph-ready Liquid Glass toggle (iOS 18+/26), tint picker, haptics
- Supports dark/light mode automatically
- Provides polished onboarding aligned with the Safari popup
- Auto-detects extension status on Mac Catalyst and offers refresh/diagnostics
- Host app:
com.freeyt.app - Extension:
com.freeyt.app.extension
These must remain consistent across Info.plist files and AppDelegate.swift.
xcodebuild clean -project FreeYT.xcodeproj -scheme FreeYTxcodebuild -project FreeYT.xcodeproj -scheme FreeYT \
-destination 'platform=iOS Simulator,name=iPhone 16' buildxcodebuild -project FreeYT.xcodeproj -scheme FreeYT \
-destination 'platform=macOS,variant=Mac Catalyst' buildxcodebuild test -project FreeYT.xcodeproj -scheme FreeYT \
-destination 'platform=iOS Simulator,name=iPhone 16'- Enable extension in Safari
- Open Safari > Develop > Show Web Inspector
- Check Console for
[FreeYT]log messages - Background worker logs:
- Extension initialization
- Rule enabling/disabling
- Storage changes
- Build succeeds without errors
- Run on iOS Simulator and enable extension in Safari
- Test youtube.com/watch?v=xxx redirect
- Test youtu.be/xxx redirect
- Test youtube.com/shorts/xxx redirect
- Toggle extension off and verify redirects stop
- Toggle back on and verify redirects resume
- Check popup UI in dark mode
- Check popup UI in light mode
- Verify test buttons open YouTube URLs
Edit FreeYT Extension/Resources/rules.json to add or modify URL patterns.
Edit the following files:
FreeYT Extension/Resources/popup.html- StructureFreeYT Extension/Resources/popup.css- StylingFreeYT Extension/Resources/popup.js- Functionality
Edit the following files for host app interface changes:
FreeYT/LiquidGlassView.swift- SwiftUI view structure and layoutFreeYT/LiquidGlassHostingController.swift- UIHostingController wrapperFreeYT/SceneDelegate.swift- Scene configuration
-
Update Bundle IDs (if needed)
- Modify Info.plist files
- Update AppDelegate.swift references
-
App Store Assets
- Screenshots of extension in action
- App preview video (optional)
- Description highlighting privacy benefits
-
Privacy Policy
- Document "No data collected, no tracking, no analytics"
- Host on webpage or GitHub
-
Code Signing
- Add Apple Developer Team ID
- Configure provisioning profiles
- Enable necessary capabilities
-
App Review Preparation
- Document privacy benefits
- Provide testing instructions
- Note declarativeNetRequest usage (no data access)
This extension:
- Does NOT collect any user data
- Does NOT track browsing history
- Does NOT use analytics
- Does NOT inject scripts into pages
- Does NOT read page content
- Only redirects YouTube URLs to privacy-enhanced versions
All processing happens locally on your device.
- iOS 15.0+ / macOS 11.0+
- Safari 15.0+
- Xcode 13.0+ (for development)
Copyright 2025. All rights reserved.
For issues or questions, please check the Safari extension logs in Web Inspector or review the debugging section above.
Built with a focus on privacy. No tracking. No cookies. Just pure YouTube content.