SlideShare une entreprise Scribd logo
1  sur  36
Télécharger pour lire hors ligne
How QCLean works?
Introduction to Browser Extensions
@qcl
Code & Beer 2015.03.06
What is QCLean?
● A browser extension/add-on that removing
ads, suggested pages and posts on
Facebook news feed for Chrome, Firefox,
Safari, Opera and IE users.
● http://qcl.github.io/QCLean/
History
● Since 2013.02.28 (2 years old!)
● Popular add-on (Firefox) 2013.04.06
● Popular extension (Chrome) 2013.08.21
Overview
● Support 5 browsers
○ Chrome/Chromium, Firefox, Safari, Opera, IE
● More than 30,000 users over the world.
○ GC ~30,000
○ FF ~8,500
● Donated mainly by Firefox user!
○ Receive about $24
○ Donate NOW!
Overview
● Rating
○ ★★★★★ 4.5/5.0 Chrome
○ ★★★★ 4.0/5.0 Firefox
○ ★★★★ 4.0/5.0 Opera
● Operating System
○ 93% Windows
● Languages
○ Chrome 74% zh-tw
○ Firefox 53% en-us
About icon
Extension/Add-on v.s. Plugin
● Extension/Add-on
○ Extensions are small software programs that can
modify and enhance the functionality of the browser.
You write them using web technologies such as
HTML, JavaScript, and CSS. (Chrome)
● Plugin
○ Plugins are shared libraries that users can install to
display content that the application itself can't display
natively. (MDN)
Extensions
● Written by HTML/JavaScript/CSS
● chrome://extensions
● about://addons
Plugins
● Written by C/C++, depend on platform
○ NPAPI, NaCl (Chrome)
● chrome://plugins
● about://plugins
Plugins
● NPAPI
○ PCManX GTK2 on Chrome using NPAPI
@qcl, @JeromeWu, 2010
Extension developing 101
● Firefox
○ http://blog.qcl.tw/2013/08/sdkfirefox-add-on.html
● Chrome
○ Create a file named manifest.json
○ Open your Chrome, go to chrome://extensions
○ Click Developer Mode
○ Then import the folder which contains manifest.json
manifest.json
{
“manifest_version” : 2,
“name” : “extension_name”,
“version” : “version_string” ,
“description” : “extension_description”
...
}
● https://developer.chrome.com/extensions/manifest
manifest.json (QCLean)
Background
background: {
“script”:[“background.js”]
}
● It exists for the lifetime of your extension.
● Only ONE instance of it at a time.
● It can be used to manage some task or state.
Permissions
● permissions: [“tabs”]
● https://developer.chrome.com/extensions/declare_permissions
● https://developer.chrome.com/extensions/permission_warnings
Content Scripts
“content_scripts” : [
{
“matches”: [match patterns],
“css”: [“kerker.css”],
“js”: [“haha.js”],
“run_at”: “document_start”
}
]
● https://developer.chrome.com/extensions/content_scripts
Content Scripts
● Content scripts are JS that run in the content
of web page
● Can not use chrome.* API of extension,
i18n, runtime, storage
● Can not use functions defined by extension
page
● Can not use functions defined by web page
or other content script
● Match Pattern
○ https://developer.chrome.com/extensions/match_patterns
Content Script
● run_at
○ doucment_start
■ Before any other DOM is constructed or any
other script is run
○ doucment_end
■ After DOM is complete, but before subresources
like images and frames have loaded
○ doucment_idle (defualt)
■ After window.onload
Remove Suggested Pages&Posts
● First commit of QCLean
Remove Suggested Pages&Posts
● What will happen when all posts on your
newsfeed use the same class name?
○ All the posts will be removed :p
● Or the class name used by other elements
on the page
○ Those elements will be removed, too :p
● Or you can not get Ad elements directly
● Select elements that you can identify then try
to do something.
Remove Suggested Pages&Posts
● Select some special elements, try to find the
Ad block, then remove it.
● If Facebook changes the structure of page,
this method will GG
● It will run once when page did load. (run_at)
Facebook infinite scrolling
● When to run the script?
○ document_start? document_end? document_idle?
○ setInterval?
● When you scrolls down the page, it will load
more and more post (and Ads)
● Need to find a trigger point to remove Ads!
Override the prototype of DOM
● Check Ads when appending new elements
into the page.
● Override the prototype of some DOM
○ HTMLDivElement.prototype.appendChild
○ HTMLUlElement.prototype.appendChild
Prevent Requesting Ads
● Check AJAX requests by overriding
XMLHttpRequest.prototype
Content Scripts
● Can not override the prototype of HTML
DOM in web page (directly)
● But we can add new element into web page.
Override prototype is DANGEROUS
MutationObserver
● QCLean-Chrome-Experiment
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
ClassName changed frequently
● Static classnames list is not enough
● I want to build a API for user, it can update
classnames list.
Some QCLean API
● Story API
○ http://qcl.github.io/QCLean/api/story.js
● Line Tagging API
○ http://qcl.github.io/QCLean/api/lineTagging.js
● XHR Cross-origin request issue
● Content security policy issue
Content Security Policy
“content_security_policy” : “policy”
● It can not be show on permission warning
● CSP works as a black/whitelisting mechanism
for resources loaded or executed by your
extension.
https://developer.chrome.com/extensions/contentSecurityPolicy
http://www.html5rocks.com/en/tutorials/security/content-security-policy/
Distribute Extensions
Cost Review Publish
Chrome $5 no directly publish
Firefox free optional directly publish
Opera free required after review
Safari free required unknow*
Extension source
● Web Store / Addon Center
○ You don’t need to mantain a update server
● Mantain your own update server
Update URL
update_url : “http://qcl.github.io/QCLean/chrome_update.xml”
● Packaging your extension (with key)
○ extension.crx
● Write update XML
○ https://developer.chrome.com/extensions/autoupdate
How others write extensions?
● Install the extension
● Get the extension’s ID (chrome://extensions)
● Go to
○ ~/Library/Application Support/Google/Chrome/Default/Extensions (mac)
QCLean
https://github.com/qcl/QCLean

Contenu connexe

Tendances

Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...MarcinStachniuk
 
Headless BDD & Responsive Test Automation
Headless BDD & Responsive Test AutomationHeadless BDD & Responsive Test Automation
Headless BDD & Responsive Test AutomationShashikant Jagtap
 
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"Fwdays
 
Acceptance testing with Geb
Acceptance testing with GebAcceptance testing with Geb
Acceptance testing with GebRichard Paul
 
行動應用開發實務 - Gradle 介紹
行動應用開發實務 - Gradle 介紹行動應用開發實務 - Gradle 介紹
行動應用開發實務 - Gradle 介紹Kyle Lin
 
Node.js meets jenkins
Node.js meets jenkinsNode.js meets jenkins
Node.js meets jenkinsEvgeny Goldin
 
Working Software Over Comprehensive Documentation
Working Software Over Comprehensive DocumentationWorking Software Over Comprehensive Documentation
Working Software Over Comprehensive DocumentationAndrii Dzynia
 
Spring framework 4.0
Spring framework 4.0Spring framework 4.0
Spring framework 4.0Diego Pacheco
 
Continuous integration with docker, buildbot and git
Continuous integration with docker, buildbot and gitContinuous integration with docker, buildbot and git
Continuous integration with docker, buildbot and gitAdieu
 
Continuous Integration JUG Hannover
Continuous Integration JUG HannoverContinuous Integration JUG Hannover
Continuous Integration JUG HannoverYann Cébron
 
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and SaucelabsiOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and SaucelabsShashikant Jagtap
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradleinovex GmbH
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for BeginnersSean Prunka
 
Codemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterCodemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterBert Jan Schrijver
 
Running jenkins in a public cloud - common issues and some solutions
Running jenkins in a public cloud - common issues and some solutionsRunning jenkins in a public cloud - common issues and some solutions
Running jenkins in a public cloud - common issues and some solutionsAndrey Devyatkin
 

Tendances (20)

Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
 
How Testing Changed My Life
How Testing Changed My LifeHow Testing Changed My Life
How Testing Changed My Life
 
That worked before
That worked beforeThat worked before
That worked before
 
Headless BDD & Responsive Test Automation
Headless BDD & Responsive Test AutomationHeadless BDD & Responsive Test Automation
Headless BDD & Responsive Test Automation
 
Swt J Face 3/3
Swt J Face 3/3Swt J Face 3/3
Swt J Face 3/3
 
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
 
Acceptance testing with Geb
Acceptance testing with GebAcceptance testing with Geb
Acceptance testing with Geb
 
行動應用開發實務 - Gradle 介紹
行動應用開發實務 - Gradle 介紹行動應用開發實務 - Gradle 介紹
行動應用開發實務 - Gradle 介紹
 
Node.js meets jenkins
Node.js meets jenkinsNode.js meets jenkins
Node.js meets jenkins
 
Working Software Over Comprehensive Documentation
Working Software Over Comprehensive DocumentationWorking Software Over Comprehensive Documentation
Working Software Over Comprehensive Documentation
 
Spring framework 4.0
Spring framework 4.0Spring framework 4.0
Spring framework 4.0
 
Continuous integration with docker, buildbot and git
Continuous integration with docker, buildbot and gitContinuous integration with docker, buildbot and git
Continuous integration with docker, buildbot and git
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Selenium camp v1
Selenium camp v1Selenium camp v1
Selenium camp v1
 
Continuous Integration JUG Hannover
Continuous Integration JUG HannoverContinuous Integration JUG Hannover
Continuous Integration JUG Hannover
 
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and SaucelabsiOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradle
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for Beginners
 
Codemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterCodemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps Disaster
 
Running jenkins in a public cloud - common issues and some solutions
Running jenkins in a public cloud - common issues and some solutionsRunning jenkins in a public cloud - common issues and some solutions
Running jenkins in a public cloud - common issues and some solutions
 

Similaire à How QCLean Works? Introduction to Browser Extensions

9 Useful Things that Every Web Developer Needs to Know
9 Useful Things that Every Web Developer Needs to Know9 Useful Things that Every Web Developer Needs to Know
9 Useful Things that Every Web Developer Needs to KnowSimobo
 
You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)Igalia
 
WordPress: After The Install
WordPress: After The InstallWordPress: After The Install
WordPress: After The InstallWordPress NYC
 
Top 10 WordPress Plugins
Top 10 WordPress PluginsTop 10 WordPress Plugins
Top 10 WordPress PluginsManny Sarmiento
 
Scraping the web with Laravel, Dusk, Docker, and PHP
Scraping the web with Laravel, Dusk, Docker, and PHPScraping the web with Laravel, Dusk, Docker, and PHP
Scraping the web with Laravel, Dusk, Docker, and PHPPaul Redmond
 
Javascript & SEO 2019
Javascript & SEO 2019Javascript & SEO 2019
Javascript & SEO 2019Edd Wilson
 
Extending WordPress' TinyMCE
Extending WordPress' TinyMCEExtending WordPress' TinyMCE
Extending WordPress' TinyMCEHristo Chakarov
 
Building Chrome Extensions
Building Chrome ExtensionsBuilding Chrome Extensions
Building Chrome ExtensionsRon Reiter
 
Shining a light on performance (js meetup)
Shining a light on performance (js meetup)Shining a light on performance (js meetup)
Shining a light on performance (js meetup)Yoav Niran
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingAlessandro Molina
 
Chrome extensions
Chrome extensions Chrome extensions
Chrome extensions Ahmad Tahhan
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausWomen in Technology Poland
 
Build and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsBuild and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsJeff Hull
 
Drupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xDrupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xWong Hoi Sing Edison
 
Creating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressCreating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressHristo Chakarov
 
Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Kazuhiro Ogura
 
Developing word press professionally
Developing word press professionallyDeveloping word press professionally
Developing word press professionallyAustin Gil
 
How Brave update works
How Brave update worksHow Brave update works
How Brave update worksIgalia
 

Similaire à How QCLean Works? Introduction to Browser Extensions (20)

9 Useful Things that Every Web Developer Needs to Know
9 Useful Things that Every Web Developer Needs to Know9 Useful Things that Every Web Developer Needs to Know
9 Useful Things that Every Web Developer Needs to Know
 
You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)
 
WordPress: After The Install
WordPress: After The InstallWordPress: After The Install
WordPress: After The Install
 
Top 10 WordPress Plugins
Top 10 WordPress PluginsTop 10 WordPress Plugins
Top 10 WordPress Plugins
 
Beginners Guide to Drupal
Beginners Guide to DrupalBeginners Guide to Drupal
Beginners Guide to Drupal
 
Scraping the web with Laravel, Dusk, Docker, and PHP
Scraping the web with Laravel, Dusk, Docker, and PHPScraping the web with Laravel, Dusk, Docker, and PHP
Scraping the web with Laravel, Dusk, Docker, and PHP
 
Javascript & SEO 2019
Javascript & SEO 2019Javascript & SEO 2019
Javascript & SEO 2019
 
Extending WordPress' TinyMCE
Extending WordPress' TinyMCEExtending WordPress' TinyMCE
Extending WordPress' TinyMCE
 
Building Chrome Extensions
Building Chrome ExtensionsBuilding Chrome Extensions
Building Chrome Extensions
 
Shining a light on performance (js meetup)
Shining a light on performance (js meetup)Shining a light on performance (js meetup)
Shining a light on performance (js meetup)
 
How to develop browser extension
How to develop browser extensionHow to develop browser extension
How to develop browser extension
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
 
Chrome extensions
Chrome extensions Chrome extensions
Chrome extensions
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
Build and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsBuild and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 Mins
 
Drupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xDrupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.x
 
Creating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressCreating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPress
 
Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)
 
Developing word press professionally
Developing word press professionallyDeveloping word press professionally
Developing word press professionally
 
How Brave update works
How Brave update worksHow Brave update works
How Brave update works
 

Dernier

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 

Dernier (20)

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

How QCLean Works? Introduction to Browser Extensions

  • 1. How QCLean works? Introduction to Browser Extensions @qcl Code & Beer 2015.03.06
  • 2.
  • 3. What is QCLean? ● A browser extension/add-on that removing ads, suggested pages and posts on Facebook news feed for Chrome, Firefox, Safari, Opera and IE users. ● http://qcl.github.io/QCLean/
  • 4. History ● Since 2013.02.28 (2 years old!) ● Popular add-on (Firefox) 2013.04.06 ● Popular extension (Chrome) 2013.08.21
  • 5. Overview ● Support 5 browsers ○ Chrome/Chromium, Firefox, Safari, Opera, IE ● More than 30,000 users over the world. ○ GC ~30,000 ○ FF ~8,500 ● Donated mainly by Firefox user! ○ Receive about $24 ○ Donate NOW!
  • 6. Overview ● Rating ○ ★★★★★ 4.5/5.0 Chrome ○ ★★★★ 4.0/5.0 Firefox ○ ★★★★ 4.0/5.0 Opera ● Operating System ○ 93% Windows ● Languages ○ Chrome 74% zh-tw ○ Firefox 53% en-us
  • 8. Extension/Add-on v.s. Plugin ● Extension/Add-on ○ Extensions are small software programs that can modify and enhance the functionality of the browser. You write them using web technologies such as HTML, JavaScript, and CSS. (Chrome) ● Plugin ○ Plugins are shared libraries that users can install to display content that the application itself can't display natively. (MDN)
  • 9. Extensions ● Written by HTML/JavaScript/CSS ● chrome://extensions ● about://addons
  • 10. Plugins ● Written by C/C++, depend on platform ○ NPAPI, NaCl (Chrome) ● chrome://plugins ● about://plugins
  • 11. Plugins ● NPAPI ○ PCManX GTK2 on Chrome using NPAPI @qcl, @JeromeWu, 2010
  • 12. Extension developing 101 ● Firefox ○ http://blog.qcl.tw/2013/08/sdkfirefox-add-on.html ● Chrome ○ Create a file named manifest.json ○ Open your Chrome, go to chrome://extensions ○ Click Developer Mode ○ Then import the folder which contains manifest.json
  • 13. manifest.json { “manifest_version” : 2, “name” : “extension_name”, “version” : “version_string” , “description” : “extension_description” ... } ● https://developer.chrome.com/extensions/manifest
  • 15. Background background: { “script”:[“background.js”] } ● It exists for the lifetime of your extension. ● Only ONE instance of it at a time. ● It can be used to manage some task or state.
  • 16. Permissions ● permissions: [“tabs”] ● https://developer.chrome.com/extensions/declare_permissions ● https://developer.chrome.com/extensions/permission_warnings
  • 17. Content Scripts “content_scripts” : [ { “matches”: [match patterns], “css”: [“kerker.css”], “js”: [“haha.js”], “run_at”: “document_start” } ] ● https://developer.chrome.com/extensions/content_scripts
  • 18. Content Scripts ● Content scripts are JS that run in the content of web page ● Can not use chrome.* API of extension, i18n, runtime, storage ● Can not use functions defined by extension page ● Can not use functions defined by web page or other content script ● Match Pattern ○ https://developer.chrome.com/extensions/match_patterns
  • 19. Content Script ● run_at ○ doucment_start ■ Before any other DOM is constructed or any other script is run ○ doucment_end ■ After DOM is complete, but before subresources like images and frames have loaded ○ doucment_idle (defualt) ■ After window.onload
  • 20. Remove Suggested Pages&Posts ● First commit of QCLean
  • 21. Remove Suggested Pages&Posts ● What will happen when all posts on your newsfeed use the same class name? ○ All the posts will be removed :p ● Or the class name used by other elements on the page ○ Those elements will be removed, too :p ● Or you can not get Ad elements directly ● Select elements that you can identify then try to do something.
  • 22. Remove Suggested Pages&Posts ● Select some special elements, try to find the Ad block, then remove it. ● If Facebook changes the structure of page, this method will GG ● It will run once when page did load. (run_at)
  • 23. Facebook infinite scrolling ● When to run the script? ○ document_start? document_end? document_idle? ○ setInterval? ● When you scrolls down the page, it will load more and more post (and Ads) ● Need to find a trigger point to remove Ads!
  • 24. Override the prototype of DOM ● Check Ads when appending new elements into the page. ● Override the prototype of some DOM ○ HTMLDivElement.prototype.appendChild ○ HTMLUlElement.prototype.appendChild
  • 25. Prevent Requesting Ads ● Check AJAX requests by overriding XMLHttpRequest.prototype
  • 26. Content Scripts ● Can not override the prototype of HTML DOM in web page (directly) ● But we can add new element into web page.
  • 29. ClassName changed frequently ● Static classnames list is not enough ● I want to build a API for user, it can update classnames list.
  • 30. Some QCLean API ● Story API ○ http://qcl.github.io/QCLean/api/story.js ● Line Tagging API ○ http://qcl.github.io/QCLean/api/lineTagging.js ● XHR Cross-origin request issue ● Content security policy issue
  • 31. Content Security Policy “content_security_policy” : “policy” ● It can not be show on permission warning ● CSP works as a black/whitelisting mechanism for resources loaded or executed by your extension. https://developer.chrome.com/extensions/contentSecurityPolicy http://www.html5rocks.com/en/tutorials/security/content-security-policy/
  • 32. Distribute Extensions Cost Review Publish Chrome $5 no directly publish Firefox free optional directly publish Opera free required after review Safari free required unknow*
  • 33. Extension source ● Web Store / Addon Center ○ You don’t need to mantain a update server ● Mantain your own update server
  • 34. Update URL update_url : “http://qcl.github.io/QCLean/chrome_update.xml” ● Packaging your extension (with key) ○ extension.crx ● Write update XML ○ https://developer.chrome.com/extensions/autoupdate
  • 35. How others write extensions? ● Install the extension ● Get the extension’s ID (chrome://extensions) ● Go to ○ ~/Library/Application Support/Google/Chrome/Default/Extensions (mac)