Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7859739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:01:16+00:00 2026-06-02T22:01:16+00:00

I implemented infinite scroll like so: new_page_value = 1; $(window).scroll(function() { if($(window).scrollTop() >= $(document).height()

  • 0

I implemented infinite scroll like so:

new_page_value = 1;

$(window).scroll(function() {
    if($(window).scrollTop() >= $(document).height() - $(window).height() - 200) {

        new_page_value = parseInt(new_page_value) + 1;

        get_page(new_page_value);

    }
});

When the user almost reaches the bottom of the page (200px left) the function get_page() is called. This contains an ajax call that gets all the contents of the new page and appends it to the <body> of the document.

Now I just realized if my site gets big and instead of having 10 small pages I have a gazillion giant pages then the user’s browser might crash if they are persistent enough to keep infinite scrolling for long time.

Would this be a possible solution to this problem:

I will keep appending the new pages to the document <body> until the 10th page, after that I will be replacing the <body> content entirely instead of appending. So using html() rather than append().

I just don’t know if this will actually work to prevent crashes. Will .html() clear the “memory” of prior html that was brought in via ajax?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:01:17+00:00Added an answer on June 2, 2026 at 10:01 pm

    I really think this is a common issue for many sites with AJAX list content. So let’s take an example at some of the most popular ( think of scale = experience ) websites and their solutions :

    Google Images

    If you check out images.google.com and you search for whatever, for e.g. “guiness”, you will see a page full of results (actually the images are ajax loaded, not the html-code, so the page is with fixed height) and when you scroll at the bottom there is a button "Show more results". This might be solution one of your problem, but is it really necessary to place a button at the bottom after, for e.g. the 10-th page? I really think it is generally a good solution for page usability and memory leaks, but it is really not a necessary option as we can see in :

    Facebook

    Facebook Newsfeed is another story. There is a button "Show more posts", but I really don’t know when exactly it is displayed rather than loading the next page of posts. It happened to me once to load 10-15 pages of posts, only by scrolling. And you know Facebook posts include videos, photos, AJAX comments and a lot of more Javascript fancy stuff, which take a lot of memory. I think they’ve managed to do this after a lot of research, how much of the users scroll to the bottom.

    Youtube

    Youtube has "Load more videos" at every page, so the solution is basically similar to Google, except that Google renders the whole html of the page and on scrolling just loads the images.

    Twitter

    Twitter supports infinite scrolling. Yep, they do it may be because tweet is 140 characters and they don’t need to worry about memory so much. After all who is willing to read more than 1000 pages of tweets at one page load. So they don’t have a button for "load more" and they don’t need one.

    So there are two solutions :

    1. Use infinite scrolling ( you should consider how much content you load and how rich it is )
    2. Use button : "Load More"

    Most of all, you should not delete already loaded content of a list.

    Nowadays everything is Javascript and Javascript has garbage collection, so it is very hard to unload the DOM ( if it has Javascript, not plain text ) and manage to remove the Garbage from Javascript. Which means that you won’t free the whole allocated memory of the unloaded content from the browser.

    Also think about of your requests, why would you need to load again something, that you have already loaded at first place. It costs another server request, meaning another database request and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented Infinite scrolling(i.e Load records when the scrollbar reaches the bottom of
I have implemented a simple server-client script like this: Server: class Server(Protocol): def connectionMade(self):
In ExtJS 4.1 beta 2 I managed to implement an infinite scroll grid with
I am trying to implement an "infinite-scroll" behaviour to load some photos on a
Possible Duplicate: UIScrollView. Any thoughts on implementing “infinite” scroll/zoom? I've got an UIScrollView and
I have a page using JQuery and I've implemented infinite scrolling on a div.
I'm trying to implement a jQuery function with an infinite loop to animate the
I implemented an infinite carousel on my site and I get the following error
I have implemented a code that generate the infinite sequence given the base case
So we know that foreach is something like : template<class InputIterator, class Function> Function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.