miguel-perez / smoothState.js

Unobtrusive page transitions with jQuery.
MIT License
4.43k stars 510 forks source link

SmoothState - Synchronous XMLHttpRequest warning #314

Open martijnvhummel opened 7 years ago

martijnvhummel commented 7 years ago

I'm using SmoothState to add feedback transitions on page close & page load.

When changing pages, the following warning occurs:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

Any way to fix this?

I'm using SmoothState in the following way:

    function transitions() {
        const $page = $('#m-scene');
        const options = {
            debug      : true,
            prefetch   : true,
            cacheLength: 2,
            forms      : 'form',
            onStart    : {
                duration: 500, // Duration of our animation
                render: function($container) {
                    // Add your CSS animation reversing class
                    $container.addClass('is-exiting');
                    // Restart your animation
                    smoothState.restartCSSAnimations();
                }
            },
            onReady: { // The function to run when the requested content is ready to be injected into the page. This is when the page's contents should be updated.
                duration: 0,
                render: function($container, $newContent) {
                    // Remove your CSS animation reversing class
                    $container.removeClass('is-exiting');
                    // Inject the new content
                    $container.html($newContent);
                }
            }
        };

        const smoothState = $page.smoothState(options).data('smoothState');
    }
perolovnas commented 4 years ago

Got the same problem. Is there a solution?