bon-loyaltybon-loyaltybon-loyaltybon-loyalty
  • 特徴
  • ドキュメント
  • ブログ
    • 新しいアップデート
    • ブログ
  • 価格
  • リソース
    • BONとSmile.ioの比較
    • BONとRivoの比較
    • BONとGrowaveの比較
    • BONとLoyaltyLionの比較
    • BONとYotpoの比較
  • パートナー
  • 無料で始める
  • デモを予約する
  • 無料で始める
  • デモを予約する
Download
✕

BON Loyalty Widget and SPA

  • ホームページ
  • ドキュメント
  • BON Loyalty Widget and SPA
Points on customer account pages
15 4月, 2023
Leave a review – Judgeme.io
13 12月, 2023

BON Loyalty Widget and SPA

18 10月, 2023
カテゴリー
Tags

BON Loyalty Widget and Single Page Application(SPA)

 

One of the issue with SPA(Single Page Application) is the website does not refresh after user authenticated(login/register). Our authentication is running on server side and it takes effect only when page refresh!

The bellow walk-around code should help BON Loyalty Widget to work well with SPA.

After customer authenticated(login/register) on website successfully, run the following code snippet to re-initiate our widget to able to authenticate customer together with BON Loyalty Widget.

function createjscssfile(filename){
    var fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript")
    fileref.setAttribute("src", filename)
    return fileref
}
 
function replacejscssfile(oldfilename, newfilename){
    var allsuspects=document.getElementsByTagName("script")
    for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
        if (allsuspects[i] && allsuspects[i].getAttribute("src")!=null && allsuspects[i].getAttribute("src").indexOf(oldfilename)!=-1){
            var newelement=createjscssfile(newfilename)
            allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])
        }
    }
}

window.bonRender = false;
replacejscssfile("https://d31wum4217462x.cloudfront.net/app/bon-loyalty.js?v=3.2.0", "https://d31wum4217462x.cloudfront.net/app/bon-loyalty.js?v=3.2.0" + new Date().valueOf()) //Replace all occurences of "oldscript.js" with "newscript.js"

 

 

Share
0
BON Loyaltyを無料で試そう!
無料で始める
Menu
BON Loyalty

BON Loyalty は、魅力的なポイント、報酬、紹介プログラムによって加盟店が顧客エンゲージメントを高めるのを支援する、信頼できる報酬および紹介ソリューション プロバイダーです。

製品

  • ホームページ
  • 特徴
  • アップストア

当社について

  • パートナーになりませんか
  • お問い合わせ

リソース

  • ブログ
  • ビデオ

法律上の

  • プライバシーポリシー
  • 利用規約
© 2021 BON Loyalty - Rewards & Referrals
facebooklinkedintwitteryoutube