0

I am trying to create something like an endless scrolling mechanism that works with multiple (at least two) pages of different websites with non-static content (could be anything). That means scrolling down page A (foo.com) all the way to the bottom and then page B (bar.net) is coming right after that.

I known that there are a lot of solutions for endless scrolling of one website which add more and more elements/ content while scrolling down the page. All of these wouldn't work with content of more then one website.

I also know that it is possible to do something like that with iframes, but a lot of websites do not work well in iframes.

I thought about extending the DOM with the HTML tag of the pages I would like to append, then I would have multiple HTML tags in one document which browsers may are able to interpret, but this is not part of the HTML standard which defines only one html tag per document. Also JS/CSS would be confused ;)

Do I have to develop a new browser with multiple window objects or is there any possibility to create my desired endless scroller within existing browsers with existing web technology?

Tobster
  • 1
  • 2

1 Answers1

0

if those pages you want to include are static, you can create a function in your backend that acquires the content of the page you need:

getContentForPage(string $url) {
    $data = file_get_contents($url);
    echo($data);
    die();
} 

then acquire the content via ajax on your frontend when the user reaches the end of the page (this could be useful: javascript: detect scroll end):

getContentForPage(url) {
    $(document).ready(function() {
        $.ajax({
            url: 'https://yourfunction',
            dataType: 'json',
            data: {url: url},
            success: function(content) {
                         $('body').append(content);
                     },

        });
    });
}

and append the acquired content at the bottom of the body. (you can adjust the content a bit before appending it).

Hope it helps.

Luca Viale
  • 31
  • 4
  • 1
    Thx for you input. It is not about static pages. I edited the question to make it more clear. – Tobster Apr 08 '21 at 21:13