Not Planned Use client side router instead of server side.

Status
Not open for further replies.

v1rtl

teen webdev
Local time
18:27
Joined
Oct 10, 2019
Messages
25
Pronouns
bruh

It is better to use client side router so browsing in Webwide will be smooth and comfortable. Now we have to wait until each page to load which is not very awesome because it is a bit annoying.

The solution to this problem is using JavaScript-based client side routing. There are some framework-agnostic libraries here:

router.js
navigo

and even an article on how to build your own router:

Router with vanilla JavaScript

There is also InstantClick that doesn't require any bundling

HTML:
<script src="instantclick.min.js" data-no-instant></script>
<script data-no-instant>InstantClick.init()</script>

 
Last edited:
Upvote 0

AndrewDavidJ

Member
Local time
10:27
Joined
Oct 7, 2019
Messages
21
Pronouns
He/Him

It is better to use client side router so browsing in Webwide will be smooth and comfortable. Now we have to wait until each page to load which is not very awesome because it is a bit annoying.

The solution to this problem is using JavaScript-based client side routing. There are some framework-agnostic libraries here:

router.js
navigo

and even an article on how to build your own router:

Router with vanilla JavaScript


If you check the footer, you'll notice that this forum is just a server running an instance of a pre-built forum solution (XenForo). So implementing their own systems like client-side routing would defeat the purpose of using an existing solution.

 

Gummibeer

Astroneer
Moderator
Local time
16:27
Joined
Oct 5, 2019
Messages
1,177
Pronouns
he/him

It doesn't have to defeat but it's harder to do. And I would say that there are bigger problems.

 

Adam

Mr. Webwide
Administrator
Local time
15:27
Joined
Sep 24, 2019
Messages
1,259
Pronouns
he/him

Thanks for the suggestion @v1rtl! As @AndrewDavidJ kindly mentioned yes we’re running on an existing solution solidified heavily in server side routing. I believe there’s some things that can be done to help make things feel a little smoother so I’ll add looking in to that on the list.

I have to say I’ve not experienced much load time waiting, pages seem to load fairly instantly for me though perhaps I am spoiled being physically close to the server (UK) and with fairly fast internet.

Would love to hear other people’s experiences of current speed. UK servers have good connections to both US and Europe and I am using Cloudflare to help deliver static assets more efficiently.

 

Gummibeer

Astroneer
Moderator
Local time
16:27
Joined
Oct 5, 2019
Messages
1,177
Pronouns
he/him

Hamburg, Germany
The page loading time is okay. But adding a reaction (like) takes "endless". It's around 1-2 seconds until the reaction shows up. For a simple Ajax post it's super slow. 🤔

 

Adam

Mr. Webwide
Administrator
Local time
15:27
Joined
Sep 24, 2019
Messages
1,259
Pronouns
he/him

Hamburg, Germany
The page loading time is okay. But adding a reaction (like) takes "endless". It's around 1-2 seconds until the reaction shows up. For a simple Ajax post it's super slow. 🤔
Interesting! It's instantaneous for me. I will do some testing on a VPN. Could you also let me know browser & OS version?

 

v1rtl

teen webdev
Local time
18:27
Joined
Oct 10, 2019
Messages
25
Pronouns
bruh

If you check the footer, you'll notice that this forum is just a server running an instance of a pre-built forum solution (XenForo). So implementing their own systems like client-side routing would defeat the purpose of using an existing solution.

There are other options for not implementing client side routing but speeding up browsing pages - InstantClick.

This portion of this code will add SPA routing to non-SPA app:

HTML:
<script src="instantclick.min.js" data-no-instant></script>
<script data-no-instant>InstantClick.init()</script>

 

Gummibeer

Astroneer
Moderator
Local time
16:27
Joined
Oct 5, 2019
Messages
1,177
Pronouns
he/him

This script is great. But only works as long as the scripts don't rely on window.onload and so on and you use the same scripts/styles (in head) on every page.


I have no idea how the JS in this forum is structured - but it could get a mess to make them compatible. But thanks for sharing it, could be an idea for my own page! :)

 

Adam

Mr. Webwide
Administrator
Local time
15:27
Joined
Sep 24, 2019
Messages
1,259
Pronouns
he/him

Hamburg, Germany
The page loading time is okay. But adding a reaction (like) takes "endless". It's around 1-2 seconds until the reaction shows up. For a simple Ajax post it's super slow. 🤔
@Gummibeer please can you let me know if reactions are sped up for you now?

 
Status
Not open for further replies.
Top