Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Leverage Browser Cache

Featured Replies

Silly question - is there anything that can force a "refresh" of the browser each time someone visits the website and still implement "leverage browser cache" like some tools want or does the former essentially nullify the later? Just curious.

 

Thank you in advance.

  • Author

For ongoing updates to the site - so the newest information / images / tweeks show up properly. Unfortunately not everyone knows to hit the refresh button on a website. Was just curious is all.

Ok I think I've got it.

 

If you mean to swap UI elements out without refreshing the browser, that's quite complex. It's known as hot reloading. A few JS frameworks do this, like React, Angular, and Meteor.

 

 

If you want to refresh the page so that the user always gets the current CSS, JS, then refreshing alone isn't a guarantee of invalidating the cache. Some implementations cache more aggressively than others, so do some browsers. You would need a way of explicitly forcing the browser to re-cache, and the only way I can think of doing this is to altar the file names of your CSS and JS files (style.css?2), that way the new version overwrites the old.

 

It's not something you would want to do every time, otherwise the user never gets served the cached file. However, it can be useful when you make a load of new changes, and you want to ensure the user isn't getting a broken layout. Regardless of this, the user will still have to refresh to see the new changes. You should avoid adding in scripts that force a browser refresh. It's awkward behaviour, and it doesn't really have any benefit.

 

I would say I'd be surprised if someone left a webpage open expecting changes to come in automatically, but seeing as a lot of websites nowadays utilise real-time services, I can imagine there's someone out there that just expects websites to work like this. I don't think it's anything to be concerned about though, refreshing is an extremely common part of web-browsing, I'd expect just about everyone knows to do it.

  • 2 weeks later...
  • 3 weeks later...

If your site is dynamically generated then you can add a timestamp after each file url as a parameter. For example, "../css/style.css?id=6745734573"

 

each time a request is made to the page a different number should be generated, so the browser see it as a new url and it fetches the url from the server instead of using the file from cache

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.