qrcode_scanner_liff.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>LIFF Starter</title>
  6. <link rel="stylesheet" href="style.css">
  7. <script charset="utf-8" src="https://static.line-scdn.net/liff/edge/2/sdk.js"></script>
  8. </head>
  9. <body>
  10. </body>
  11. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  12. <script>
  13. /**
  14. * Display data generated by invoking LIFF methods
  15. */
  16. function displayLiffData() {
  17. document.getElementById('browserLanguage').textContent = liff.getLanguage();
  18. document.getElementById('sdkVersion').textContent = liff.getVersion();
  19. document.getElementById('isInClient').textContent = liff.isInClient();
  20. document.getElementById('isLoggedIn').textContent = liff.isLoggedIn();
  21. document.getElementById('deviceOS').textContent = liff.getOS();
  22. document.getElementById('lineVersion').textContent = liff.getLineVersion();
  23. }
  24. $(document).ready(function() {
  25. liff.init({
  26. liffId: "1656494344-JovNdOv0"
  27. })
  28. .then(() => {
  29. alert('liff.init()'); // test
  30. })
  31. .catch((err) => {
  32. });
  33. // login
  34. if (!liff.isLoggedIn()) {
  35. liff.login();
  36. // scanCodeV2 call
  37. liff.scanCodeV2().then(result => {
  38. // e.g. result = { value: "Hello LIFF app!" }
  39. alert('scanCodeV2()'); // test
  40. }).catch(err => {
  41. console.log(err);
  42. });
  43. }
  44. });
  45. </script>
  46. </html>