How QCLean Works: Introduction to Browser Extensions
* Introduction to QCLean and browser extensions.
* How to write a simple chrome extension and how QCLean removes suggested pages and posts on Facebook newsfeed.
* How to inject code and override DOM prototype on webpages.
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)
Create a file named manifest.json ◦ Open your Chrome, go to chrome://extensions ◦ Click Developer Mode ◦ Then import the folder which contains manifest.json
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
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
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.
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!
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/