1<!DOCTYPE html> 2<!-- 3 Copyright (C) 2014 ZXing authors 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 --> 17<html> 18 <head> 19 <title>App Installation</title> 20 21 <meta charset="UTF-8" /> 22 <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" /> 23 24 <script src="https://code.jquery.com/jquery-1.12.4.min.js" 25 integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" 26 crossorigin="anonymous"></script> 27 28 <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Sans" /> 29 <link rel="stylesheet" href="scan.css" /> 30 </head> 31 32 <body> 33 <img src="img/app.png" id="logo" alt="ZXing" /> 34 <br /> 35 <div id="info"> 36 <p>To scan code with your mobile camera you need to install free Barcode Scanner -app</p> 37 <br /> 38 <a href="https://play.google.com/store/apps/details?id=com.google.zxing.client.android" target="_blank" class="playLink"><img alt="Get it on Google Play" src="img/badge.png" /></a> 39 <br /> 40 <small><a href="#" id="man">or enter code manually</a></small> 41 </div> 42 <div id="installed"> 43 <br /> 44 <b>Thank you for installing!</b> 45 <p>To scan barcode and return to webpage <a href="">click here</a></p> 46 <br /> 47 <small style="opacity:0.5">Remember to give 5 stars to our app on Google Play</small> 48 </div> 49 <div id="error"> 50 <br /> 51 <b>Something went wrong :-(</b> 52 <p>You clicked link, but app can't start. Make sure that you have installed Barcode Scanner -app.</p> 53 <a href="https://play.google.com/store/apps/details?id=com.google.zxing.client.android" target="_blank" class="playLink">Try downloading again</a> 54 </div> 55 <br /> 56 57 <script type="text/javascript"> 58 $(function(){ 59 var playLink = $(".playLink"); 60 var man = $("#man"); 61 // If device is Android, change URI to Android-friendly. Otherwise use HTTP URI. 62 if(navigator.userAgent.toLowerCase().indexOf("android") !== -1) { 63 playLink.attr("src","market://details?id=com.google.zxing.client.android"); 64 } 65 66 // Detect GET-parameters from URL 67 var GET = {}; 68 $.each(location.search.substr(1).split("&"),function(k,v){ 69 var prm = v.split("="); 70 GET[decodeURIComponent(prm[0])] = decodeURIComponent(prm[1]); 71 }); 72 73 // Check is it possible to use manual mode 74 if(GET["ret"] === "" || GET["ret"] === void(0) || GET["ret"].indexOf("http") === -1){ 75 man.hide(); 76 } 77 78 // When Google Play -badge is clicked ... 79 playLink.click(function(){ 80 $("#info").hide(); 81 $("#error").hide(); 82 $("#installed").show(); 83 var url = location.href; 84 if(url.indexOf("?") === -1) url = url + "?"; 85 url = url + "&installed=1"; 86 $("#installed a").attr("href",url); 87 }); 88 89 // When manual-button is clicked ... 90 man.click(function(e){ 91 e.preventDefault(); 92 var man = prompt("Please type barcode below"); 93 if(man){ 94 var url = GET["ret"]; 95 if (url.indexOf("{CODE}") === -1) { 96 // Return URL has no {CODE} place holder, so add a query parameter 97 if (url.indexOf("?") === -1) 98 url = url + "?" + encodeURIComponent("{CODE}") + "=" + encodeURIComponent(man); 99 else 100 url = url + "&" + encodeURIComponent("{CODE}") + "=" + encodeURIComponent(man); 101 } else { 102 // Replace the {CODE} placeholder in the return URL with the scanned code. 103 url = url.replace("{CODE}", encodeURIComponent(man)); 104 } 105 location = url; 106 } 107 }); 108 109 // If app isn't installed after visiting on Google Play, show error 110 if(GET["installed"] !== void(0)){ 111 $("#info").hide(); 112 $("#error").show(); 113 } 114 }); 115 </script> 116 </body> 117</html>