SoFunction
Updated on 2025-04-07

JS code to generate and download QR codes

I won’t say much nonsense, I will just post the js code to you. The specific code is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http:///TR/html4/"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>js_canvas_download</title> 
<script type='text/javascript' src='/jquery/2.1.1/'></script> 
<script type="text/javascript" src="//1.0/"></script> 
</head> 
<body> 
<div ></div> 
<a  download=""></a> 
<button >save</button> 
</body> 
</html> 
<script> 
jQuery('#qrcode').qrcode({width: 500,height: 500,text: ""}); 
$("#save").click(function(){ 
var canvas = $('#qrcode').find("canvas").get(0); 
var url = ('image/jpeg'); 
$("#download").attr('href', url).get(0).click(); 
return false; 
}); 
</script> 

The above is the code for generating and downloading QR codes introduced by the editor to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!