Skip to content

How About Loading the Whole Document #372

@nazimwibsoft

Description

@nazimwibsoft

There should be a way in the Soothstate js to load the whole document if one need to? so we dont have to specify container Id it will just reload the whole content. I did some experiment and had to modify the script a bit.

I used this small piece of code to replace HTML content of whole document:
document.open("text/html", "replace");
document.write(data);
document.close();

This will execute all my scripts correctly and load the page like we normally do but with a transition giving user a transition experience without reload the page.

** onReady will be Like this **

onReady: {
duration: 0,
render: function ($container, $newContent) {

                $container.removeClass('is-exiting');

                var currentUrl = $container.data('smoothState').href;
                var cache = $container.data('smoothState').cache;

                var currentPageCache = cache[currentUrl];

                document.open("text/html", "replace");
                document.write(currentPageCache.doc);
                document.close();
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions