Using Ctrl-F5 on page with Routing and Parameters

Current set-up : SPA Pages, Windows 10, MySQL, PHP

My client has a habit of often refreshing pages using Ctrl-F5 which is fine on most pages, except those Routed Pages with Parameters.

Navigating to a 'business' page with a parameter of '3'

Then pressing Ctrl-F5 gives…

And the Network tab from DevTools shows…

Is there a way round this (without trying to tell the client to stop using Ctrl-F5 :crazy_face:)?

His argument is “Well this never happens on any other website I go to!”

Are you sure your url is correct?
This doesn’t really seem quite right to me:

Hi Teodor, yes it is correct on my local machine. Bit of a mish-mash address, but all fine.

image

image

And on the live server it shows as this.

image

It has the same problem on both local machine and live server.

Well can you test on the live server then and check the exact 404 errors in the console -where is it looking for the files which are not found?

Is there a base tag on the page? It seems that you are using relative urls and with routing and no base tag it tries to load the content relative to the path in the url and not where the page is located.

This is the Network Tab in DevTools when navigating to 'https://daviesandgray.co.uk/admin/business/3' which is correct.

Then on a Ctrl-F5, the routed page shows as '/admin/business/3' highlighted with green box below.
And all the 404 pages have added the '/admin' directory as highlighted with blue box.

The '/admin' directory is where the actual page sits 'https://daviesandgray.co.uk/admin/_manage_business.php'.

The Wappler files are actually stored at root level as shown above, but because they have '/admin' added to them, then they cannot be found.

'<meta name="ac:route" content="/admin/">'

There should be a base tag like:

<base href="/">

In Wappler, when saved to local machine

In Wappler, when saved to live server

From DevTools on live server

image

I see on your screenshots that the base tag is at around line 90, it should be about the first thing in the head. Any script tag above the base tag will not load correctly if the base comes later.

That sorted it!
Well spotted @patrick :beer:

I moved the base tags to the top of the head tag. I now have this when saving local

image

And this when saving to live server

image

And I can confirm that everything displays as expected on Ctrl-F5 :smile:

1 Like