In this example it simply reloads the page, but can replace reload with anything


    window.onpageshow = event => {

        if (event.persisted) {

            console.log("Page reopened from bfcache");

            location.reload();

        }  

    }