qrcode_scanner_liff.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // scanCodeV2 call
  34. liff.scanCodeV2().then(result => {
  35. // e.g. result = { value: "Hello LIFF app!" }
  36. alert('scanCodeV2()'); // test
  37. }).catch(err => {
  38. console.log(err);
  39. });
  40. });
  41. </script>
  42. </html>