Most folks are as happy as they make up their minds to be.

Everyone faces depression, anxiety and negative emotions. Although, we cannot change the circumstances but we can change the way we perceive them. You start feeling worthless when negative emotions…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to use Content Blocker Extension?

About block rule of Content Blocker Extension

Content Blockers are app extensions that you build using Xcode. They indicate to Safari a set of rules to use to block content in the browser window. Blocking behaviors include hiding elements, blocking loads, and stripping cookies from Safari requests.

Choose File > New > Target and select Content Blocker Extension. Give your Content Blocker a name.

setup Content Blocker Extension

In your Xcode project, open the folder with the same title as your Content Blocker. This folder contains the action request handler and a JSON file, along with a property list file and an entitlements file. Open the blockerList.json file.

In the JSON file, write rules to define content-blocking behaviors. Each rule is a JSON object containing action and trigger dictionaries. The action tells Safari what to do when the trigger is matched. The trigger tells Safari when to perform the corresponding action. Content Blockers are JSON arrays of these rules.

Note: Failing to set the block rules will all rule disabled.

Let ’s set the trigger. The trigger describes the condition for executing the action. The important thing here is the url-filter. The url-filter includes Capture URLs by Pattern and Use Trigger Fields to Define Patterns. (see reference for patterns)

For example, if you want to block www.example.com, write:

You enable the content blocker and open the page in Safari, you will see the following notation.

Now let ’s make it possible to block only ads www.example.com.

The load-type option can be first-party or third-party.

First-party blocks the display of the page if the url specified in url-filter matches the url in the Safari search bar.

Add a comment

Related posts:

Pay To Keep Playing

Why pay once when you can pay to keep playing? While more and more Massively Multiplayer games are moving away from a subscription based revenue stream, more and more single-player and multi-player…

Inheritance and Composition

We developers try to reuse the logic as much as possible. One way to do that is inheritance and the other is composition. Inheritance: Inheritance is when a subclass inherits its properties from a…

To dismiss God

To dismiss God. Man will say or ask; why did He let this happen. Where was He when this happened? Why didn’t He stop it if he’s loving and knows everything? This happens on a micro-level. To achieve…