Okay
  Public Ticket #3986954
Issues with Back Button and AJAX Loading in Customizer
Closed

Comments

  •  1
    Kamil started the conversation

    This ticket applies to Nanotech wordpress version. I’ve noticed two issues related to navigation and AJAX loading:

    Back Button Behavior (AJAX Disabled): When AJAX is disabled in the Customizer, using the browser’s back button - e.g. navigating from the Stories page back to Agency (as in the original dummy content) - results in an almost empty page. The header loads correctly, but the <main> element remains with opacity: 0. Additionally, the magic cursor shows a loading animation, but nothing else happens, and the content does not load.

    Portfolio Items in Menu (AJAX Enabled): When AJAX is enabled and portfolio items (even though not originally intended for this purpose) are added to the top menu, navigating between regular pages works fine. However, clicking on a portfolio item in the menu results in a blank page being loaded.

  •  2,099
    Support replied

    Hello Kamil,

    Is it possible to provide wp admin access in a private comment? so we can have a look.

    Make sure we have full rights using Appearance -> Theme File Editor in case we need to do some debugging

  •   Kamil replied privately
  •  2,099
    Support replied

    Hello Kamil,

    you can send us wp admin access in a private comment or

    try adding in FirstLoad() function, /js/scripts.js file the following code

    window.addEventListener( "pageshow", function ( event ) {       

          var historyTraversal = event.persisted || ( typeof window.performance != "undefined" && window.performance.navigation.type === 2 );      

          if( historyTraversal ) {           

              // Handle page restore.           

              window.location.reload();        

         } 

    });

    hard refresh the content (Ctrl+F5) before testing.

  •  1
    Kamil replied

    Thank you! Looks like it works now. I'm using childscript.js in child theme. But it still works here even without pointing directly in functions.php of child theme. But i used this nonetheless:

    function my_custom_scripts() {

        wp_enqueue_script(

            'custom-js',

            get_stylesheet_directory_uri() . '/js/childscript.js',

            array(),

            null,

            true

        );

    }

    add_action('wp_enqueue_scripts', 'my_custom_scripts');