iframemanager
iframemanager copied to clipboard
Ist there a way to re-run?
Hi,
i am loading some video portfolios via ajax on an wordpress theme. Is there a way to re-run the script to detect the
Thanks for your help!
Cheers Tobias
+1 on this. Facing the exact same issue. Running a combination of
cc.reset();
cc.run(cookieConsentConfig);
manager.run(managerConfig);
on each dynamic page load works, but only if the user clicks the "Load once" button. Clicking "Don't ask again" breaks the script. This probably also has to do with the CookieConsent reset()
function not being able to detect already executed scripts.
I create the hotfix this issue. When a page change occurs in react / next.js, it does not detect DOM changed. My solution reset and re-run iframemanager at each page change. PR #55
import { useRouter } from 'next/router'
...
useEffect(() => {
// const cc = initCookieConsent()
const im = iframemanager()
setTimeout(() => {
im.run(...)
}, 1000) // Since it is not SSR, it is necessary to allow time for the client to render it
return () => {
im.reset() // stop observers, reset scoped variables
}
}, [router.asPath])
...