Defresh - Cut your site's link load speed time in half with 1 <script> tag

Project URL: formerly https://defresh.glitch.me

Defresh is a site that me and @anon70439135 (formerly @idodev) have created. It’s a free-to-use software that makes your link loading time way faster.

It does this by not reloading the page when you click on a link.

How was this done? With a combo of AJAX and the history API, called PJAX More info here.

I’d love your feedback!

Thanks,

DerDer56 (& @anon70439135)

4 Likes

hmmm, i like the project! but the github link returns a 404

1 Like

fixed it just now! lol

1 Like

WOW! Great job!!!

1 Like

here’s the link anyway:

thank you very much! :smile:

Hi, thanks for opening up a discussion about this.

Main question from me: what makes it faster to load a page with AJAX and render it with document.write?

Also, could you describe how you found that it cuts your site’s link load speed time [sic] in half?

we ran some simple tests using Date.now to find the difference between the link click and page load, and the ajax was around 1.9 times faster, which is very close to 2. nice question though!

This looks neat. Could you publish this to NPM? That way it could get on jsdelivr and cdnjs.

1 Like

You should also support touchscreens with the touchstart event
http://instantclick.io/click-test

2 Likes

but the onclick works on mobile 2

Brave thinks you’re giving a 404 error, it’s asking if I want to find the page on wayback machine.
This is glitch also so you might wanna set some limits for max pages otherwise a page with lots of links will make lots of requests.

1 Like

i changed the hosting to github tho

1 Like

Could you also minify it?

1 Like

ok, no problemo, thats a good idea

regular will be moved to defresh.glitch.me/commented.js

ok, i minified it! thank you 4 the idea!

1 Like

Expect some down time from the site, beacuse we are acquiring a js.org domain, defresh.js.org

3 Likes

hmmmm, seems promising…

1 Like

Here are some ideas you should consider

  1. For really heavy sites preload all the links within the region of the viewport(where the user can see) and download more when the user scrolls and make sure to delete the old links
  2. Use an optional special protocol with the server to be able to request multiple pages with one request
  3. Detect low bandwith and automatically disable/enable some features
  4. Not sure if this is possible with the capabilties of js but don’t load images and videos and iframes until the users scrollbar is near
  5. For downloads preload only the first 100kb or some number of data
2 Likes

Lazy loading images?

1 Like

the link AJAX saves to an array when you hover over them.

when you click, it writes the data

edit: this was removed to stop extra requests

1 Like

our new domain is online: defresh.js.org . the css is having some trouble tho.

Suggestion: Open two projects one with and another without defresh. Record yourself clicking a link on both and use a video editor to put the projects side to side and slow them down a bit and turn it into a gif

2 Likes

ok, right now there is an issue with the script, when it’s fixed we might do that

ha! just realized why the script wasn’t working.

it checks for .js in the link.
defresh.js.org/anything returns true

this is why i love coding! :slight_smile:

1 Like

Lol
20chars


1 Like

Try checking if it endswith js. Also very rarely js files will not have the .js header and also glitch’s anticache makes stuff like
cdn.glitch.com/somefile?v=23493842943

um yeah i already changed it to do this

but i will update it to do the ? thing

ok, the script is updated to work with querystrings

Imagine making defresh a chrome extension, fast sites wherever you go lol but might break things

4 Likes

interesting idea, but the software is intended for coders, not browsers, and we are not planning of making it an extension

and ur right, that

.

ok i added your split-screen video idea to the start page

Yay, it really shows the difference!

1 Like

wow! it was almost 3 times faster

its normally 2x though so im keeping the slogan:
“Cut your site’s link load speed time in half with 1 <script> tag”.

version 3 is out with the new defreshUnload() function.!

read more here

2 Likes

Heyo, is there any comparison graph for defresh vs regular loading?

3 Likes

yes, on the start page video

Hey @DerDer56,

I suggest you perform split by split comparison on really heavy websites with images, lot of fonts and external resources, and maybe extensive resources and you can find out if it makes a big difference :slightly_smiling_face:.

4 Likes

ok, I will work on that

3 Likes

the new video is expected to be on the start page within 10 minutes

4 Likes

Cool @DerDer56


Woah, that was really fast!

@khalby786 what are you referring to?

This :point_up: (20chars wakanda forever)

2 Likes

video done, im uploading as we (chat) speak.

1 Like

also chrome allows you to simulate slow wifi which can also be useful

1 Like

how can you do that


uploaded, check start

1 Like

Awesome! Will give this a try!

1 Like

image
here’s how you do it also i accidentally replied to myself

2 Likes

lol

Hey there! Currently Testing out Defresh on a static page. Here are my results. Please take note that i am also gonna do a heavy load test.
Screen Shot 2020-07-28 at 12.55.12 AM

1 Like

ok

That’s a huge difference although I found a small glitch in the split-by-split comparison video where the styles break while loading for a couple of milliseconds before the styles load properly.

1 Like

Im also thinking the same thing too. As the video recording clearly shows that defresh is faster than the normal refresh. Also i have caching disabled.

2 Likes

Hey everyone! Here’s my test on heavy load.
Testing info:

  • Internet Speed: 25 Mbps (throttled down to 20MBPS)
  • Browser: Chrome
  • Caching: Disabled
  • Ping with Glitch Servers: 242.640 ms
  • Connection: WiFI (very near to router)

Screen Shot 2020-07-28 at 1.34.59 AM
Heavy Load. This includes Bootstrap, WebFonts, Font Awesome, SVGs, PNGs and JS files.

testing

Please note that not everyone has the same results.

2 Likes

um, the defresh shouldn’t reload at all

I refreshed it manually. The GIF above is the video of 3 takes of the test.

oh, the whole point of defresh is for clicking on links

1 Like

but we will work to fix the loading issue by adding an onload function to the script.

1 Like

we’ll try to fix that soon.

I really like the process that makes this fast on loading. Hope you guys have fun while improving!

ps: pls make the onload faster:)

i figured out the reason for slow reloading, it’s the script’s async attribute. it will soon be changed to defer.

fixed!

i know, that was fast!

I found a small glitch in the split-by-split comparison video where the styles break while loading for a couple of milliseconds before the styles load properly.

UPDATE: this only happens on external styles

1 Like

Villager Number 9 | Heroes Wiki | Fandom

BREAKING NEWS!!! we are now partnered with glitchchord!

read more here.

If anybody else would like to partner their project with Defresh, plz respond to this post.

1 Like

How about adding fetch support to defresh to use modern technologies or does it already do that

3 Likes

Fetch isn’t supported on IE, might need to use a polyfill for that.

1 Like

TL;DR So, I see it says it uses the history or the SE. so is it returning a 304.

ajax works on all browsers that fetch worrks on, doesn’t it?

Ajax works on all browsers, however, IE doesn’t have fetch, they use XMLHttpRequest and ActiveXObject.

1 Like

exactly. thats why im using ajax

Ajax is a set of web development techniques using many web technologies on the client side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously without interfering with the display and behavior of the existing page.

Ajax isn’t a specific tool (like for instance jquery) but techniques to do async requests. I can recommend you to just use the FetchAPI and polyfills for incompatible browsers. Using jQuery is just waste.

1 Like

i don’t use jquery though, defresh is pure vanilla javascript

1 Like

AJAX is a part of the JQuery package. So what are you using?

Mind you, you can do it, but I imagine you are using JQuery

jQuery implements AJAX, however, using fetch and fetch polyfills is also AJAX.

1 Like

I feel like Fetch & Fetch Polyfills is almost-all-browser-friendly and lightweight.

im using an xmlhttprequest lol i got confused about the whole ajax/xml thing :slight_smile:

u can see more about whats going on here

404   

fixed it just now lol

i added a / after .js, returning an error

You could create a smaller version of pace.js while using Defresh.

1 Like

what’s that?

Pace.js is a JS library that allows you to add a loader (a real loader) that depends on AJAX requests to correctly depict a loading bar.

1 Like

but im using xml not ajax, would it still be possible

lol socketio kept using polling so the loading bar kept showing up every 5 seconds so I got rid of socketio temporarily
it’d be confusing if hovering on a link makes a loading bar appear

3 Likes

lol

I don’t think you completely understand what Ajax means. Ajax is basically the techniques to request data from somewhere without stopping the end-user navigating around your page.

There is numerous ways to do Ajax, some of which are using

  • XMLHttpRequest object.
  • ActiveXObject
  • fetch API.
  • jQuery $.get, $.post, $.update, $.patch, etc.
  • Axios .get(), etc
  • An other libraries that depend on fetch and XMLHttpRequest and ActiveXObject.

What is AJAX?

AJAX = A synchronous J avaScript A nd X ML.

AJAX is not a programming language.

AJAX just uses a combination of:

  • A browser built-in XMLHttpRequest object (to request data from a web server)
  • JavaScript and HTML DOM (to display or use the data)
3 Likes

ok, i was confused earlier but now i get it

Only if Axios was included by default like the Fetch API.

2 Likes

anyone could just use the defreshUnload() function to create one (a pace.js loader).

more

Update: Defresh is fully initialized on Glitchchord!

1 Like

oh boy, i can’t wait it out! cool.
mrjunboon17