Does anyone know how to avoid losing AJAX/PJAX on page reload? It seems Webflow Vanilla takes over when page is refreshed. Although it’s weird, because mouse or browser forward and back buttons still let PJAX do it’s thing. We even lose lenis and all the links. Has anyone encountered this problem when trying to introduce AJAX/PJAX?
Thanks.
Here is my site Read-Only: [LINK]1
(how to share your site Read-Only link)
Hi there,
When using custom JavaScript with AJAX/PJAX and async loading enabled, scripts may not execute in the intended order, causing functionality issues. This happens because async loading allows scripts to load in parallel, which can disrupt dependencies between your custom scripts.
Here are the main solutions to address this:
For external JavaScript files, add the defer attribute to your script tags:
<script defer src="your-script.js"></script>
For inline JavaScript, wrap your code in a window load event handler:
window.addEventListener('load', function() {
// Your custom JavaScript code here
});
These approaches ensure your scripts execute in the correct order and after the DOM is fully loaded. For complex implementations, you can work with a developer or reach out in the Webflow forum for specific guidance.
Hopefully this helps! If you still need assistance, please reply here so somebody from the community can help.