I'm using the code below to trigger a bar code scanner android app from the android chrome browser using a appscript page and eventually get the scanned code into a html field in my appscript app.
So far the scanner gets activated, scans the QR code but than it returns to the url with the QR code at the end:
I get this below error :
No HTML file named desc?QRcode=364 was found. (line 44, file "MainFile", project "Code")
And line 44 of my MainFile is: return HtmlService.createTemplateFromFile(e.parameter['page']).evaluate();
364 is the QR scanned code.
I need to get the QR code into the form field.
desc.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<a href="zxing://scan/?ret=https://script.google.com/macros/s/AKfycbw6WjNPEKuY73l_c6_2DfF75FUL3IVX7hEP-QuOIEGJIJ7j2hDQ/exec?page=desc?QRcode={code}">Scan</a>
<input id="user" value="">
</body>
</html>
<script>
//retriave url value
google.script.url.getLocation(function(location) {
document.getElementById("user").value = location.parameters.QRcode[0];
});
</script>
serverSide.gs
function doGet(e) {
Logger.log( Utilities.jsonStringify(e) );
if (!e.parameter.page) {
// When no specific page requested, return "home page"
return
HtmlService.createTemplateFromFile('SessionLoginHTML').evaluate();
}
// else, use page parameter to pick an html file from the script
return
HtmlService.createTemplateFromFile(e.parameter['page']).evaluate();
}
?QRcode={code}be&QRcode={code}? - Rafa Guillermo?to&the url stops returning the QRcode part although it does reloads the page(without the QRcode={code}`) - user2916405&, but it's unclear what your new problem is. - TheMaster