Lazy load/Pagination issue

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #28251
    Olivier Langlois
    Participant

    after entering a post page, if you return back to the blog posts list page by clicking the back button, the list reset to its initial display setup.

    Imagine someone reading the posts from top to bottom. This is going to be annoying when they reach page X, to have to press X times on the ‘Load More’ button to read the next post.

    Is there any way that a user could retrieve the last list state when he returns to the list page when clicking on the back button?

    To see what I mean, here is the list page:
    https://olivierhealthtips.com/blog-posts/

    Just click 3-4 times on the ‘Load More’ button, enter a post and click on browser ‘back’ button.

    #28276
    Raghavendra
    Moderator

    Why not use the option to open the link to post in new window. I would use it all the time if I expect my users to come back to original page.

    #28292
    Olivier Langlois
    Participant

    Hi Raghavendra,

    My WP designer suggested me exactly the same solution…

    I’m not sure that I like the option to open a new tab. I feel like it could be messy. The ‘open a new tab’ solution has a ‘spammy’ feel to it. A visitor could end up with dozens of tabs open by our site. There is no website that I like that does that… I think that this has the potential to annoy people.

    Do you have examples of websites doing it that way so I can change my feelings about the idea? that seems unusual…

    Like if I go on Youtube and browse a very long AJAX video list, scroll down a bit, click on a video and click the ‘back’ button, I will return on the video list exactly as I left it.

    it is as if your js code reset its state without discerning if it is a fresh load or a load back…

    #28343
    Raghavendra
    Moderator

    Thanks for your feedback. It’s really tough to implement the functionality you are describing. We will probably need to update the URL on each load and then when the user hours the back button, we need to reload pages of posts in one go based on the URL thathat needs to be populated. Better option and more intuitive would be to open the post in a pop-up window of some kind and when the user hits the back button, you go back to the parent window. Basically we need to load the post window using AJAX as well just like we load pages of posts archives. May be you have better ideas -I am just thinking loud here. Can be done but can take time.

    #28364
    Olivier Langlois
    Participant

    Ok, I get what you say about being tough to do.

    I didn’t realize that when you press back, the page is automatically reloaded from scratch because of the page cache-control is set to no-cache.

    I’m not really a WP dev so feel free to educate me. Where does the no-cache comes from? Is this built-in directly into WP or this come from WPBakery Page Builder?

    I’ll probably live with the current behavior for now as I feel that going to the popup would be like replacing an annoyance by another annoyance….

    #28373
    Raghavendra
    Moderator

    The cache control headers come from WordPress itself although some plugins can modify the same. The browsers do a good job of caching the page and loading the same when you hit the back button. But it cannot load the content that was triggered by AJAX based server calls unless the plugin or theme repeats the call to repopulate the content. Having the URL updated on each click of load more button will help retrieve the last state by parsing the URL content in Javascript. It would not not work if you had multiple grids in the page though.

    #28776
    Olivier Langlois
    Participant

    FYI, by using a cookie, browser session persistent storage (PersistJS) and by modifying the following files:

    assets/js/lvca-blocks.js
    assets/js/lvca-blocks.min.js
    includes/blocks/block-functions.php
    includes/blocks/block.php
    assets/js/persist.min.js
    includes/addons/portfolio/class-lvca-portfolio.php
    includes/blocks/headers/block-header-6.php
    includes/blocks/modules/module-13.php

    I made the filter selection persistent + your AJAX cache is persistent over different page visits during a single browsing session.

    With some more work on the js AJAX cache, I could make this solution even better by giving back the last loading state persistent. ie: you have loaded 3 pages out 4, upon returning on the page, the same 3 pages fetched from the cache are displayed back to you.

    #28783
    Raghavendra
    Moderator

    I am glad to hear you are able to make these changes – I did not think of cookie solution before. Would love to have a look and see if we can incorporate the same into the product. Meanwhile, I am also working to solve some of these issues (though it won’t solve the load more or make filter persistent). I am exploring WordPress pagination (as opposed to AJAX) as one of the options to help users navigate back to the previous page open as part of pagination. It has its challenges when multiple grids are present in the page and I hope to make progress soon.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘WPBakery Page Builder Addons Support’ is closed to new topics and replies.