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

Source: Internet
Author: User

The browser cannot enter the link, only by scanning the QR code to achieve. But sometimes see an interesting site, want to share, you have to first to turn the link into a QR code site. Turn it into a QR code first. Scan again. A little trouble. So write a plugin. Generate two-dimensional code directly.

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

With the browser actions implementation. The user clicks the icon. Displays the QR code in the popup.html code, such as the following:

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:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvawxvc3rlcg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">


What are the good links, direct scan sharing just fine

Source code 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.