Extending your App with Safari Application Extensions
  • Services
    Close
      • Enterprise Services
      • Enterprise Portal Development
      • eCommerce Portal Development
      • Enterprise Integration Services
      • ERP Implementation
      • Magento Development Services
      • Cloud and Infrastructure Management
      • Cloud Infra & Management Services
      • Remote Infra Management Services
      • DHIS2 Cloud Hosting Services
      • Consulting Services
      • UX & UI Consulting Services
      • Architectural Consulting Services
      • Performance Tuning & Assessment
      • Liferay Consulting Services
      • DevOps Consulting Services
      • Software Testing Services
      • Software Testing Services
      • Custom Application Development
      • Single Page Application Development
      • Mobile App Development
      • Android Application Development
      • iOS App Development
    Close
  • Solutions
    Close
      • Digital Experience Platform
      • Collaboration Portal Development
      • Intranet Portal Development
      • Enterprise Content Management System
      • Human Resource Management System
      • Hospital Management System
      • Learning Management System
      • Community Portal Development
      • Partner Portal Development
      • Liferay Enterprise Solutions
      • Liferay Portal Development
      • Liferay Migration and Upgrade Services
      • Liferay Consulting Services
      • Liferay Performance Tuning
      • Enterprise Mobility Solutions
      • Network Monitoring Solutions
    Close
  • Products
    Close
      • HRMS
      • Commercium
    Close
  • Resources
    Close
      • Blogs
      • News
      • Events
      • Case Studies
      • White Papers
      • Books
    Close
  • Portfolio
  • en EN
    ar ARnl DUen ENfr FRid INms MAru RS
Inquire Now
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Inquire Now
  • Home
  • Services
    • Enterprise Services
      • Enterprise Portal Development
      • eCommerce Portal
      • Enterprise Integration Services
      • ERP Implementation
      • Magento Development Services
    • Cloud and Infrastructure Management
      • Cloud Infrastructure Management Services
      • Remote Infrastructure Management Services
      • Cloud Hosting Services DHIS2
    • Quality Assurance
      • Software Testing Services
    • Custom Application Development
      • Single Page Application Development
    • Mobile App Development
      • Android Application Development
      • iOS App Development
  • Consulting
    • UX & UI Consulting
    • Architectural Consulting Services
    • Performance Tuning & Assessment
    • Liferay Consulting Services
    • DevOps Consulting Services
  • Solutions
    • Digital Experience Platform
      • Collaboration Portal Development
      • Intranet Portal Development
      • Enterprise Content Management System
      • Hospital Management System
      • Learning Management System
      • Human Resource Management System
      • Community Portal Development
      • Partner Portal Development
    • Enterprise Mobility Solutions
    • Network Monitoring Solutions
  • Products
  • Technologies
  • Resources
    • Case Studies
    • Blogs
    • White Papers
  • Company
    • Who We Are
    • Career
    • Partners
    • News & Events
  • Contact
  1. >
  2. Technologies
  3. >
  4. Safari Application Extensions
940 Share
2
3
2
1
0
Safari application
940 Share
2
3
2
1
0

Safari Application Extensions

Overview of Extending your App with Safari App Extensions

A Content Blocker app extension customizes the way Safari and Safari View Controller handle your content. The extension can tailor your content by hiding elements, blocking loads, and stripping cookies from Safari requests. Your app extension provides content-blocking rules to tell Safari how to manipulate content.

Content-blocking rules are created in a structured format ahead-of-time, declaratively, rather than running extension-provided code at the moment a decision about blocking needs to be made. WebKit compiles the ruleset into a bytecode format that it can process efficiently at runtime, reducing latency between when a page request is created and when it is dispatched over the network. Safari does not request undesired content. By avoiding unnecessary or unwanted downloads, Safari uses less memory and has better performance.

Safari on macOS and Safari on iOS use the same format for content-blocking rules, an array of JSON objects. Each rule contains a trigger dictionary and an action. The trigger specifies when a rule applies, and the action specifies what Safari should do when a match is found.

Begin creating your content-blocking rules by examining the web page resources with Web Inspector. After identifying the elements you want to block, create content-blocking rules that match only those target elements and choose the actions to perform.

Capabilities

  • Customize web pages
  • Block loading of resource of element
  • Add toolbar buttons
  • Display popovers
  • Add items to context menus on web pages

Benefits

Built Using App Extension
  • Developed using Xcode
  • Run native code
Distributed with your app
  • Sold through the App Store
  • Same Version as your app

Type

  • Content Blockers
  • Page modification and communication with native code
  • Extending Safari’s UI

Why are content blockers needed?

Apps will tell safari the content they want to block ahead of time instead of safari consulting with the app during the actual loading process. This model is fast and efficient because it doesn’t have to consult with the app during loading, and the content blockers are compiled into byte code that can be evaluated very efficient.

Content blockers identify the subset of content or resources on a page doesn’t show or even load.

Using a Content Blocker extension, you provide Safari with content-blocking rules that specify how Safari treats content such as images, scripts, and pop-up windows.

There are two main ways to block the using a content blocker:
1) Hide element on a page
2) Block resource from loading altogether

What content blocker can do?

1. Hide element

Each content blocking is JavaScript Object Notation (JSON).
Object content action and trigger dictionaries: The “action” dictionary contains a “type” key with the value “block”, and the “trigger” dictionary contains a “url-filter” key with the value.

 For example:
"action": {
"type": "css-display-none",
"selector": "#links"
} 

We define a tag place and trigger dictionary user for that

 "trigger” : {
“if-domain”: [“bigbearsgolfblog.com”],
“selector” : “.*”
} 

now,

 {
"action": {
"type": "css-display-none",
"selector": "#links"
},
"trigger": {
"if-domain": [
"bigbearsgolfblog.com"
],
"selector": ".*"
}} 

Action -> type “css-display-none” is a described as hiding an element and Action -> selector is list of pages or page where we apply an action.

In trigger “if-domain” we specify which domain we want the style to apply to and which resource we want to apply to when loaded.

2. Block a load

 For example:
"action": {
"type": "block"
} 

Action type is “block”, which means block a load any resource matching the corresponding trigger.

 "trigger”: {
“url-filter”: [“tracking_script”],
“resource-type”: [“script”],
“load-type”: [“third-party”]
} 

1) URL-filter: It is a regular expression that will be checked against the current site’s URL. match any URL’s.
2) resource-type (array of strings, optional): We block the loading script.
3) Load-type: It is an array of strings.
There are two types namely:

  1. “First-party” (a load is considered as first party when it comes from scheme, domain, and port is the main resource of the page or applies to things loaded from the current site)
  2. “third-party” (applies to things loaded anywhere but the current site).

4) “URL-filter-is-case-sensitive” (boolean, optional): It changes the “url-filter” case-sensitivity.
5) “if-domain”/”unless-domain” (array of strings, optional): matches the domain of the document.

How to do content blockers on iOS?

Management settings in your app

– API in the SafariServices Framework

 - SFContentBlockerManager.reloadContentBlockerWithIdentifie (
identifier: String,
completionHandler: ((NSError?) -> Void)?
) 

Bring Blocking on OS X

  • Brought the same model to the Max.
  • Faster and more memory efficient.
  • canLoad has been deprecated.

Step1: Create Project -> add extension (content blocker) -> run the project -> go to setting -> safari -> content blocker -> enable the option
Step2: Write down in json file

 [
{
"action": {
"type": "css-display-none",
"selector" : "div.footer-holder"
},
"trigger": {
"url-filter": ".*"
}
}
] 

Step3: Once again time go to setting -> safari -> content blocker -> disable the option -> enable the option and reload the safari browser.

Use cases:

1) We can create our own Ad. Blocker application.
2) We can manage children content control using content blocker.
3) Manage safari content violation using own blocker application.
4) Manipulate/Inject Some Styles to Webpage using own application.

Related Blogs

Vinita

Insider Note - Enable Remote Workplaces to Quickly Adapt to a Changing Paradigm

https://www.knowarth.com/wp-content/uploads/2020/05/vinita-blog-1.png 400 1140 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2020-05-06 19:16:042020-05-07 17:31:59Insider Note - Enable Remote Workplaces to Quickly Adapt to a Changing Paradigm
Chintan Shah

Voice of Reason: Prepare Better for Operational Continuity

https://www.knowarth.com/wp-content/uploads/2020/05/chintan-shah-blog-1.png 400 1140 Chintan Shah https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Shah2020-05-06 18:21:102020-05-07 17:56:11Voice of Reason: Prepare Better for Operational Continuity
CM Talks

CM Talks

https://www.knowarth.com/wp-content/uploads/2020/04/cm-talks.png 400 1140 Chintan Mehta https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Mehta2020-04-29 15:41:412020-04-29 17:19:21CM Talks

Playing the Long Game and adapting to change in times of crisis

https://www.knowarth.com/wp-content/uploads/2020/04/playing-the-long-game.png 400 1140 Chintan Shah https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Shah2020-04-29 15:19:482020-04-29 17:15:43Playing the Long Game and adapting to change in times of crisis
More Blogs

Services

  • Enterprise Portal Development
  • eCommerce Portal Development
  • Cloud Infra & Management Services
More Services

Solutions

  • Enterprise Content Management System
  • Learning Management System
  • Hospital Management System
More Solutions

Categories

Mobile Application Technologies

Related Case Studies

SAAS based productivity management suite

SAAS based productivity management suite

https://www.knowarth.com/wp-content/uploads/2017/02/SAAS-based-productivity-management-suite.jpg 657 1920 Krupal Khatri https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Krupal Khatri2017-02-28 15:19:302017-02-28 16:39:41SAAS based productivity management suite
Hospital Management System with Secure Mobile Application

Hospital Management System with Secure Mobile Application

https://www.knowarth.com/wp-content/uploads/2016/12/Hospital-Management-System-with-Secure-Mobile-Application.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-12-30 17:41:182017-01-27 22:48:33Hospital Management System with Secure Mobile Application
LIFERAY Clustering with enhanced Security

LIFERAY Clustering with enhanced Security

https://www.knowarth.com/wp-content/uploads/2016/11/LIFERAY-Clustering-with-enhanced-Security.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-11-22 19:39:172017-01-30 11:35:59LIFERAY Clustering with enhanced Security
Amazon Web Services (AWS) to Open Stack Migration

Amazon Web Services (AWS) to Open Stack Migration

https://www.knowarth.com/wp-content/uploads/2016/11/Amazon-Web-Services-AWS-to-Open-Stack-Migration.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-11-22 17:51:202017-01-30 11:46:29Amazon Web Services (AWS) to Open Stack Migration

Audit, Document Management and Collaboration Platform

https://www.knowarth.com/wp-content/uploads/2016/11/Case-Study-Audit-Document-Management-and-Collaboration-Platform.jpg 677 1400 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-11-22 15:16:142017-01-30 14:51:46Audit, Document Management and Collaboration Platform
Continuous Integration & Deployment Using Chef, AWS Code

Continuous Integration & Deployment using Chef, AWS Code Deploy and AWS OpsWork

https://www.knowarth.com/wp-content/uploads/2016/05/Continuous-Integration-Deployment-Using-Chef-AWS-Code.jpg 657 1920 Chintan Mehta https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Mehta2016-05-24 15:50:112017-01-30 14:53:39Continuous Integration & Deployment using Chef, AWS Code Deploy and AWS OpsWork
PreviousNext

Follow Us

HRMS-ad-new
MySQL8 For Big Data
Mastering Apache Solr 7.x

Latest Tweets

Tweets by @KNOWARTH
Chintan Mehta
By Chintan Mehta
December 2, 2016

Be the first to get latest blogs
Join our mailing list to get the latest updates! We will not spam you.
Loading

Services

  • Enterprise Portal Development
  • Liferay Consulting Services
  • Mobile App Development
  • Software Testing Services
  • ERP Implementation
  • RIM Services
  • View All Services

Solutions

  • Liferay Portal Development
  • Liferay Migration and Upgrade
  • Digital Experience Platforms
  • Enterprise Mobility Solutions
  • IT Monitoring Solutions
  • Learning Management System
  • View All Solutions

Products

  • Commercium
  • HRMS

Resources

  • Case Studies
  • Blogs
  • Events
  • White Paper
  • Books

Company

  • Who We Are
  • Career
  • Our Partners
  • Our Clients
  • Cookie Policy

ANZ: +61 423 683 702
APAC: +91 98664 98179
USA: +1 (408) 656-6493
marketing@anblicks.com
Mobile App User Experience (UX) – Best Practices Mobile Commerce Trends M-commerce trends to watch out for in 2017
Scroll to top

Schedule A Consultation

Field marked * are mandatory.