// For example, if the endpoint URL of the LIFF app is https://example.com/path1?q1=v1// and its LIFF ID is 1234567890-AbcdEfgh
liff.permanentLink
.createUrlBy('https://example.com/path1?q1=v1').then((permanentLink)=>{// https://liff.line.me/1234567890-AbcdEfgh
console.log(permanentLink);});
liff.permanentLink
.createUrlBy('https://example.com/path1/path2?q1=v1&q2=v2').then((permanentLink)=>{// https://liff.line.me/1234567890-AbcdEfgh/path2?q=2=v2
console.log(permanentLink);});
Module not found: Error: Can't resolve 'crypto' in 'node_modules/js-crypto-env/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
if(liff.isApiAvailable('shareTargetPicker')){
liff.shareTargetPicker([{type:"text",text:"Hello, World!",},],{isMultiple:true,}).then(function(res){if(res){// succeeded in sending a message through TargetPicker
console.log(`[${res.status}] Message sent!`)}else{const[majorVer, minorVer]=(liff.getLineVersion()||"").split('.');if(parseInt(majorVer)==10&&parseInt(minorVer)<11){// LINE 10.3.0 - 10.10.0// Old LINE will access here regardless of user's action
console.log('TargetPicker was opened at least. Whether succeeded to send message is unclear')}else{// LINE 10.11.0 -// sending message canceled
console.log('TargetPicker was closed!')}}}).catch(function(error){// something went wrong before sending a message
console.log('something wrong happen')})}
Google Analyticsなど外部のロギングツールを利用する場合は、LIFFアプリにアクセスしたユーザーの機密情報をよりセキュアに管理するために、LIFF v2.11.0へのアップデートをお勧めします。ロギングツールへは、機密情報を含まないliff.init()実行後のURLを送るようにしてください。
「LINE API Use Case(opens new window)」では、「予約」「テーブルオーダー」「会員証」「自治体向け情報配信」「予約電話」といったカテゴリ別に、LINE APIを活用したユースケース、クライアント事例、デモアプリなどをご紹介しており、各APIの挙動をわかりやすく体験しながら、実際の活用例を参考にすることができます。
liff.init(data=>{// Now you can call LIFF APIconst userId = data.context.userId;},err=>{// LIFF initialization failed});
LIFF v2の初期化方法:
// Using a Promise object
liff
.init({liffId:"123456-abcedfg"// Use own liffId}).then(()=>{// Start to use liff's api}).catch((err)=>{// Error happens during initialization
console.log(err.code, err.message);});// Using a callback
liff.init({liffId:"123456-abcedfg"}, successCallback, errorCallback);
発生日時において、liff.getFriendship()の利用時にLIFFアプリを開いているブラウザでオリジン間リソース共有(CORS)(opens new window)ポリシー違反のエラーが発生し、正常に機能が利用できない場合がありました。すでに復旧しており、現在は正常にliff.getFriendship()をご利用いただけます。
LINE v11.3.0では、多くのポートレートモード(縦向き表示)用にデザインされたLIFFアプリでの体験をより良くするために、iPadで開いたLIFFアプリは「formSheet(opens new window)」サイズ(幅540×高さ620ポイント)のモーダルウィンドウで表示されるようになります。
LINE Developersコンソールの[LIFF]タブのサイズの設定(Compact/Tall/Full)に関わらず、iPad上のLINE v11.3.0で表示したLIFFアプリは、必ずformSheetサイズのモーダルウィンドウで表示されます。