I am needing WIX to do a full page load when I use the navigation on site.
Why?
I have custom js in the that needs to be loaded on each page.
What do I mean?
When I navigate using wix menu objects, the section is persistent across pages. It does not load, which means my js is not loading on each page.
When I navigate using the browser address bar, and manually type in full page names, the section does load correctly.
Is there something that I am missing?
- Is there a setting I have been unable to find?
- Is there some velo code that I need to add?
I have tried to use the setting within:
Custom Code
Code Settings
Load code on each new page
And this is not having the desired outcome
For those that are interested, here is the solution. I have placed this in the masterPage.js file.
In summary - compare the url string of the current to the last page, if it is different, then issue a refresh after 1 ms. The refresh is noticeable from time to time, but I can live with this for my purpose.
(Note that I am not a js guru, and there may be better implementation)
import { session } from ‘wix-storage’ ;
import wixLocation from ‘wix-location’ ;
let pageA = session . getItem ( “page2” );
session . setItem ( “page1” , pageA );
$w . onReady ( function () {
let pageB = wixLocation.url ;
session . setItem ( “page2” , pageB );
if ( pageA != pageB ) {
setTimeout (() => wixLocation . to ( wixLocation.url ), 1 );
} else { }
});