Navneet Singh
Navneet Singh

Reputation: 11

How to block a specific URL in google chrome extension?

I am trying to develop a chrome extension which blocks a specific URL like gmail.com and when someone goes to gmail.com they got pop up to enter the password to continue to that website, this may decrease unauthorized way of accessing your personal sites.

If you know something about let me know, I have googled some extension and there are two-three extensions which block sites like stay focused.

Upvotes: 1

Views: 7742

Answers (1)

Konrad Dzwinel
Konrad Dzwinel

Reputation: 37903

The simplest way to do this is to inject a content script to all pages that should be 'protected' (you can set it up using "content_scripts"/"matches" setting in manifest.json). When script is injected and fired it should display the login dialog and handle the sign in process. You may use this code as a starting point for your extension.

BTW, I don't think that your extension can really protect anything working the way you described it. Extensions may be easily deactivated/uninstalled.

Upvotes: 2

Related Questions