Chrome Plugin Development-----------convert URLs to QR code Website2qrcode

Source: Internet
Author: User

The browser can not enter the link, only by scanning the two-dimensional code to achieve, but sometimes see an interesting site, want to share, but also first to the link into a two-dimensional code of the site, first turned into two-dimensional code, and then scan, a little trouble. So write a plug-in, directly generate two-dimensional code.

Files to be referenced: jquery.qrcode.js (convert text to QR code) and jquery

With the browser actions implementation, the user click on the icon, in the popup.html display QR code, the code is as follows:

Manifest.json:

{    "name": "Website2qrcode",    "version": "1.0",    "description": "Translate URL into QR code",    "Browser_action": {      "Default_icon": "Icon.png",    "Default_title": "QRCode",    "Default_popup": "Popup.html"  },  " Permissions ": [        " tabs ",         " http://*/* ",         " https://*/* ",         " notifications "      ],       " Manifest_ Version ": 2  
Popup.html:

<! DOCTYPE html>
Popup.js

function Getcurrenttaburl (callback) {//Gets the URL and title of the current tag chrome.tabs.getSelected (function (tab) {var taburl = Tab.url;var Tabtitle = Tab.title;callback (Taburl,tabtitle);}); Listen for the click Time Document.addeventlistener (' domcontentloaded ', function () {Getcurrenttaburl (function (taburl,tabtitle) {  var website = document.getElementById (' website ');  var title = document.getElementById (' title ');  website.textcontent = "URL:" + taburl;  Title.textcontent = "title:" + Tabtitle;  Generate a two-dimensional code    jQuery (' #QRcode '). QRCode (TabURL);});
Results:




What are the good links, direct scan sharing just fine

Source Address: Https://github.com/iloster/WebSite2QRcode

Chrome Plugin Development-----------convert URLs to QR code website2qrcode

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.