123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>LIFF Starter</title>
- <link rel="stylesheet" href="style.css">
- <script charset="utf-8" src="https://static.line-scdn.net/liff/edge/2/sdk.js"></script>
- </head>
- <body>
- </body>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
- <script>
- /**
- * Display data generated by invoking LIFF methods
- */
- function displayLiffData() {
- document.getElementById('browserLanguage').textContent = liff.getLanguage();
- document.getElementById('sdkVersion').textContent = liff.getVersion();
- document.getElementById('isInClient').textContent = liff.isInClient();
- document.getElementById('isLoggedIn').textContent = liff.isLoggedIn();
- document.getElementById('deviceOS').textContent = liff.getOS();
- document.getElementById('lineVersion').textContent = liff.getLineVersion();
- }
- $(document).ready(function() {
- liff.init({
- liffId: "1656494344-JovNdOv0"
- })
- .then(() => {
- alert('liff.init()'); // test
- })
- .catch((err) => {
- });
- // login
- if (!liff.isLoggedIn()) {
- liff.login();
- // scanCodeV2 call
- liff.scanCodeV2().then(result => {
- // e.g. result = { value: "Hello LIFF app!" }
- alert('scanCodeV2()'); // test
- }).catch(err => {
- console.log(err);
- });
- }
- });
- </script>
- </html>
|