In this SharePoint tutorial, we will discuss how to generate QR Code in SharePoint using JavaScript. We can generate QR code in SharePoint 2013/2016 and SharePoint Online using the same JavaScript code.
Create QR Code in SharePoint using JavaScript
Step 1: Login to the SharePoint site and create a new web part page in SharePoint
Step 2: Edit the SharePoint web part page -> Add a Script Editor Web part in the page
Step 3: Add the below code inside snip in the Script Editor WebPart -> Save the page.
<script src="/sites/DLH/SiteAssets/qr.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
function generatefn() {
if ($('#QR_URL').val() != '')
onLoadQrCode($('#QR_URL').val(), 'DivImage');
}
</script>
<input type="text" id="QR_URL" value="" style="width:250px" /><input onclick="generatefn()" type="button" id="btnGenerate" value="Generate" />
<div id="DivImage"></div>
You can download qr.sj file.
Step 4: Once you click on Save button, the Design page will appear here as below Image.
Step 5: Next Download the QR code scanner on your mobile and try to scan the code and see what happens here. Below is the result after scanning.
You may like following SharePoint tutorials:
- SharePoint 2010 to SharePoint Online Migration Steps using Metalogix tool
- SharePoint 2010 to SharePoint 2013/2016/2019 Migration Steps (Database attach method)
- Generate One Time Password (OTP) in Asp.Net using C#.Net
- Create and Manage Task List in SharePoint
- Display SharePoint List Items in Hyperlink in SharePoint Hosted Add-in or Apps
- Display SharePoint List items in a data table using Rest API and jQuery
- Show or Hide text box on dropdown selected index change event using HTML and JavaScipt
- Send a Happy Birthday email to employees using Microsoft Flow in SharePoint Online
Please try and put comments here if anyone facing any issue. Hope this SharePoint tutorial explains, how to generate QR code in SharePoint using JavaScript.
Rajkiran is currently working as a SharePoint Consultant in India . Rajkiran having 7+ years of experience in Microsoft Technologies such as SharePoint 2019/2016/2013/2010, MOSS 2007,WSS 3.0, Migration, Asp.Net, C#.Net, Sql Server, Ajax, jQuery etc.He is C#Corner MVP (2 Times).