Questions tagged [safari-content-blocker]

This tag should be used with questions about the safari-content-blocker extension (iOS and OS X).

The safari-content-blocker extension is available for booth iOS and Mac OS X. Content on websites such as javascript, css-elements, images and other files can be blocked from loading.

49 questions
18
votes
2 answers

Determine if user has enabled application's Safari content blocker extension

I'm working on a Safari Content Blocking extension. I intend to show setup instructions if the extension is disabled and to show settings if it is conversely enabled. How can I determine if the extension is enabled by the user? I've seen this method…
Ryan Brodie
  • 6,554
  • 8
  • 40
  • 57
9
votes
1 answer

content blocker works in simulator but does not work in iPhone device

i am working on content blocker and block the adult site so, this code is perfect work on simulator when i test on iPhone 6 then its no one site is block Alamofire.request(url).responseJSON { response in if let data = response.data, let…
ikbal
  • 1,114
  • 1
  • 11
  • 30
8
votes
1 answer

Multiple filters for Safari content blocking Swift

I'm building a simple content-blockin app. It works, but i want to apply filters (which webs to block and which not) with UISwitches (saved to NSUserDefaults). Because the content blocking extension uses json it's unclear to me how can i select…
David Robertson
  • 1,561
  • 4
  • 19
  • 41
8
votes
3 answers

iOS Content Blocking Extension Loading Multiple JSON Files

Is it possible to return multiple JSON files from a Content Blocker Extension? In my UI users enable / disable different filters and each filter is represented by a separate file. I currently have (which only loads one despite iterating through…
Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232
7
votes
4 answers

iOS9 Safari content blocker extension not invoked

I'm playing with XCode7 beta, trying to test the shiny new "Content Blocker Extension". The example class is adopting the same NSExtensionRequestHandling protocol as the (already known) Sharing extension. The essential difference from Sharing…
Pavel Zdenek
  • 7,146
  • 1
  • 23
  • 38
5
votes
3 answers

How to know what's blocked by WKContentRuleList

As we know, we can use WKContentRuleList to block url requests/cookies or perform other actions in WKWebView. Is there any way that we can know what has been blocked by the WKWebView based on that WKContentRuleList?
where_am_i
  • 133
  • 7
5
votes
0 answers

iOS Safari Content Blocker "ignore-previous-rules" not working

The desired functionality is for my content blocker is to hide a div with class ._mqsb on every page on youtube, not including an url that contains youtube.com/results somewhere The first rule works fine, hiding every ._mqsb on every page with…
HJo
  • 1,902
  • 1
  • 19
  • 30
5
votes
2 answers

Reloading Content Blockers in iOS

I have heard that iOS has support for content blockers, and that all blocking is done by a file called blockerList.json that resides in the App Bundle. While I know that SFContentBlockerManager.reloadContentBlockerWithIdentifier() will reload the…
saagarjha
  • 2,221
  • 1
  • 20
  • 37
4
votes
1 answer

Does anyone know how you actually update the blockerList.json file for the safari content blocker?

Apple has provided us with an API to update the json used for safari content blockers (SFContentBlockerManager.reloadContentBlockerWithIdentifier) so it's clear that Apple intends for us to make the blocked items customizable. I've been playing…
jasono
  • 213
  • 2
  • 13
4
votes
2 answers

Unable to read app group's NSUserDefaults but able to write on it

I have a really strange problem while developing a content blocker extension. I'm trying to share data between it and my app using NSUserDefaults with an app group but but reading something from the app group always crashes the extension. Here is a…
Armand Grillet
  • 3,229
  • 5
  • 30
  • 60
4
votes
0 answers

iOS - Safari Content Blocker can't read data from NSUserDefaults

I've been working on a Content Blocking application for some time now. I have a switch in the main app that should turn of the blocking filter. The value of this switch is saved in an NSUserDefaults property that's enabled with App Groups so the…
3
votes
1 answer

Update Safari App Extension Content Blocker list

When creating a native content blocker from a Safari App Extension, how do I update the static JSON list after the plugin has loaded? The only way I can see right now is to deploy a whole new version of the app which wouldn't update automatically…
Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62
3
votes
1 answer

Swift: Reloading Content Blockers list in iOS 9

I'm try a new function in IOS 9: Content Blockers (Ad Blockers) In my app, I have 3 item (website) that I want block (ex: 1. abc.com 2. def.com 3. xyz.com) With every item, I use Switch control (ON/OFF) in order to user choose BLOCK or NOT BLOCK…
chaunv
  • 833
  • 6
  • 15
3
votes
3 answers

iOS Content Blocker Whitelist Website

In my content blocker, is there a way to prevent ad-blocking on a certain website? For example, if I want to block ads on all websites besides The Verge, is there a way to prevent the blocking rules I provided from affecting this page?
erdekhayser
  • 6,537
  • 2
  • 37
  • 69
3
votes
1 answer

Does iOS 9 content blocker works in UIWebView?

Content blockers are enabled from Safari and work as extensions, but do they affect the UIWebView (in-app browser)?
themoah
  • 167
  • 2
  • 13
1
2 3 4