New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Only preload pages once per page load #132
Comments
I think it's also important to remember that once a page is preloaded it should be cached. Therefore, it should not have to hit the server again. I also think if I am not mistaken that if the mouse leaves the link the loading is stopped. |
The pages aren't necessarily cached, when I mouseover links on instantclick.io I see a bunch of 200 requests in the network tab. Best case is 304 responses if your server supports it. |
Yeah HTML is never really cached but If you can I recommend doing it when using this plugin cache the pages for and hour or so. Would depend on the page content as well. If you are looking to reduce server load or update the plugin as you suggested. |
It was more difficult than I expected, but I got some basic preload caching working on a fork. Seems like everything is setup to handle 1 preload at a time, so I changed it to only cache the last moused over link. Here's the diff for reference: effinggames/instantclick@b0c0443 Ideally it would cache multiple requests at a time, but that would take a big refactor. Or a clever way to cache XMLHttpRequest's. |
Okay got the caching working with multiple requests. Didn't have to refactor too much, was able to store cached xhr objects and feed them in. |
This is cool |
the first issue I noticed when I heard about instantclick, came to open an issue and found this :) great fix 👍 |
On mouve hover, store the url, if another mouse hover is done, then check the last mouse hover url and do not preload it. I did this for my Wordpress plugin Zajax. |
You can use caching with InstantClick the same way you do without InstantClick: by setting
The big benefit to implement caching in JavaScript would be that it would cache out of the box, but not every site needs caching. When you have highly-dynamic content, such as a forum where new messages get posted nearly every second, you don’t want to have lagging content. |
Hey it seems like repeatedly mousing over over links is loading the next page multiple times. I think limiting preloading to once per page load or something like once every 30 sec would really help cut down on page loads on the backend.
The text was updated successfully, but these errors were encountered: