diff --git a/index.js b/index.js index a2582bd62..0a6382836 100644 --- a/index.js +++ b/index.js @@ -42,11 +42,14 @@ function loadContentAndInitializeApp(/** @type { init: any } */ mainElmModule) headTags.forEach(headTag => { appendTag(headTag); }); + + new MutationObserver(function() { + document.dispatchEvent(new Event("prerender-trigger")); + }).observe(document.body, { attributes: true, childList: true, subtree: true}); + } else { setupLinkPrefetching(); } - - document.dispatchEvent(new Event("prerender-trigger")); }); return app