- read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
- start by adding a new extension target to your iOS app of type “content blocker”
- launch the app using the main target’s scheme + a call to
SFContentBlockerManager.reloadContentBlockerWithIdentifier()
with the extension’s id inapplication:didFinishLaunchingWithOptions:
to auto-reload the blocker in development mode - if you don’t call
reloadContentBlockerWithIdentifier()
then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving) - use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
- things like periods in the
url-filter
regexp need to be escaped with double backslashes, e.g.facebook\\.net
- if you use
if-domain
, it needs to be an array, even for one element - domain
foo.com
might not matchwww.foo.com
even though I think it’s supposed to (UPDATE: They've changed it in one of
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based off the metrics on the dashboard of the mixpanel music finder demo | |
create table events ( | |
id bigserial primary key, | |
user_id varchar, | |
created_at timestamptz not null default now(), | |
name varchar not null, | |
properties jsonb not null default '{}' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var MemoryFS = require('memory-fs'); | |
var SingleEntryDependency = require('webpack/lib/dependencies/SingleEntryDependency'); | |
var fs = new MemoryFS(); | |
fs.mkdirpSync('/src'); | |
fs.writeFileSync('/src/app.js', 'require("./dep.js")', 'utf-8'); | |
fs.writeFileSync('/src/dep.js', 'module.exports = function(msg){console.log(msg)}', 'utf-8'); | |
fs.writeFileSync('/src/extra-entry.js', 'require("./dep.js")', 'utf-8'); |