Saturday, November 28, 2015

View unlimited articles on Harvard Business Review and Economist.com


In this post I am going to discuss with you a chrome extension I developed to view unlimited articles on Harvard business Review and Economist.com

Harvard Business Review allow unregistered users to view 5 articles at max where as Economist allows unregistered user to view at max 3 articles for the 4th article click it asks users to pay for registration before viewing new articles.

One manual hack is to install a chrome extension like Cookie inspector or Cookie manager and delete the cookie before proceeding to view other (blocked) articles.

to avoid this manual work. I created a chrome extension which does this automatically.

So the idea is the same for both Harvard Business Review(HBR) and Economist. That is every time a user clicks on any hyper link delete the associated cookie of the respective domains.
The code can be found at github repo

Technical layout :
Architecture of chrome extension allows user to create scripts of various types. For ex: Content scripts or background scripts. Content scripts can access the DOM structure of the HTML page on which it has the permission to inject where as background scripts can access Chrome* api and can run some background job either in persistent mode or trigger based mode.

WORKING : 
For this chrome extension, I have created a content.js which gets injected in the DOM structure of Economist/HBR as defined by the permissions given in the manifest file. So every time a user clicks on any anchor tag ('<a href="....">'). A message is sent to background script (BackGround.js). So in this case background script is triggered via a message sent by content script and hence is non persistent as configured by manifest file.

When the background script receives a trigger from content script it invokes chrome api for cookies. So first it gets all the cookies associated with the concerned domain - in this case HBR and Economist. After all the cookie associated with the HBR or Economist domain is received, they are iterated one at a time and removed using chrome api.

AFTER EFFECTS :
After you add chrome extension on your chrome. Go to hbr.org.
Now select any articles to read, you will land on specific article page. The number of articles left for free view can be seen at bottom of page.


Now go back to hbr.org by clicking on anchor tag on the left side of the page


Same goes for economist.com

How to install Chrome Extension on chrome :
1.) Go to chrome://extensions/
2.) Next check the developer mode
3.) click on load unpacked extension


4.) Find the location of the chrome extension 

Now you are good to go. Just in case if you have already opened HBR or Economist make sure to reload the page.


Monday, November 16, 2015

Hello World - Chrome Extension

Here are two introduction tutorials (beginner to intermediate level) I wrote on the chrome extension.

http://www.codeproject.com/Tips/832199/Chrome-Extension-Save-URLs-of-All-Open-Tabs-in-a-N
http://www.codeproject.com/Tips/826733/Chrome-Extension-How-to-Use-Commands-and-Backgroun

I won an International Women Hackathon organised by Hackearth in March 2015.
Here is what it does :


Here is the code for this https://github.com/deepika087/HackerEarth_Hackathon_LinkedInTimeLined