Comments (5)
Some of the pagination libraries
Do you have any examples?
It sounds like something very specific and I'm not sure if I should bloat IAS to support every other lib out there, but if this is a common thing or used by large libs I can consider it.
from infinite-ajax-scroll.
Hi fieg,
You can check this example out: https://us.brinks.com/insights. See the next button at the bottom of the page when you go to the last page. The href of the next button becomes href="javascript:;" on the last page.
We dont need to do library-specific logic. Just need to do an additional check to make sure the next button URL is valid before requesting it.
I know there is no customer support for the paid customer but I did pay for the license. I think it will help others to have this feature.
from infinite-ajax-scroll.
Thank you for your reply!
I see you point and agree, which leads me to a few questions:
- What is a valid url and what's not? And how can we validate that?
- Should IAS do this check, or should it allow users to implement this check themselves, in the few cases where this is needed?
- Should IAS perhaps execute javascript prefixed hrefs? Not sure if this is even possible tho.
If you have thoughts on these questions, please share.
from infinite-ajax-scroll.
We can check if the URL is a valid URL by using regex: https://stackoverflow.com/questions/1303872/trying-to-validate-url-using-javascript, or simply check if the URL starts with https?://
To get the absolute URL, we can use this: https://stackoverflow.com/questions/3943281/resolving-relative-urls-in-javascript
It turns out that the .href attribute of a A element (not .getAttribute('href'), but .href) returns the resolved (absolute) URL.
- For
<a href="https://example.com/page1">
, the.href
will returnhttps://example.com/page1
; - For
<a href="/page1">
, the.href
will returnhttps://example.com/page1
; - For
<a href="javascript:;">
, the.href
will returnjavascript:;
; - For
<a href="javascript:alert('111');">
, the.href
will returnjavascript:alert('111');
;
Once we got the absolute URL, we can check if the URL is valid or not.
from infinite-ajax-scroll.
Thank you for your detailed reply 🙏 I will take it into consideration. If you are up for it, feel free to send in a PR with a code proposal.
from infinite-ajax-scroll.
Related Issues (20)
- Is there any way to make this work with dynamic content like pjax or htmx HOT 3
- Get next from JSON HOT 5
- Bind on load (DOMContentLoaded)
- Regularly and randomly failing resize test
- Accessibility and Keyboard Navigation HOT 9
- VueJS support/example
- Doesnt work if link includes Get request (?srch=value) HOT 2
- Running over CDN vs npm, and pagination question HOT 3
- Limit the number of items HOT 1
- Not able to reload after ajax content load. HOT 1
- After form POST or GET result pagination not working HOT 2
- Prevent the url from changing when scrolling or in other words, the url stays at the same address? HOT 1
- Element ".pager__prev" not found for "options.prev
- Use item selector with ::last
- Prevent to close HTML Tags in appendFn
- <video> not loading in firefox HOT 1
- Loading duplicate pages on refreshing or going back to page
- Using scrollcontainer creates Js error on unbind
- Unhandled Promise Rejection: TypeError: null is not an object (evaluating 't[o].sentinel.getBoundingClientRect') infinite-ajax-scroll.min.js:11:11548
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infinite-ajax-scroll.