Google Chrome extension-Use https

Source: Internet
Author: User

In the past, Google Chrome was expanded by using JavaScript bookmarks, just as in previous articles. Today, I finally saw Google Chrome's extended feature (document), so I wrote one.

Requirement: I subscribed to some Google group content in Google Reader, but I forgot to start from it. I cannot open the content directly from Reader. The reason is that the RSS link provided by Google group uses HTTP, but it seems to be blocked, but it can be opened through HTTPS. However, after each opening, you must manually add "S" after the Protocol! In fact, I have always wanted to write something similar to the previous script, but I haven't written it yet.

Function and operation method: after the extension is installed, if the page opened is HTTP (or cannot be opened through HTTP ), A "green arrow pointing to a lock" icon is displayed at the end of Chrome's address bar. Click this icon, and the protocol section in the URL will be replaced with HTTPS, and the rest will remain unchanged.

: Use https v1.0.crx (not submitted to Google Chrome extension Gallery)

MainCode:( In the background page)

 chrome. pageaction. onclicked. addlistener (function (Tab) {chrome. tabs. update (tab. ID, {URL: "https: //" + TAB. URL. substr (7), selected: true}) ;}); chrome. tabs. onupdated. addlistener (function (Tabid, changeinfo, Tab) {If (tab. URL. substr (0, 7 ). tolowercase () = 'HTTP: // ') {chrome. pageaction. show (Tabid);} else {chrome. pageaction. hide (Tabid) ;}}); 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.