How to ask browsers to refresh (flush) the cache of my website?


Tags: javascript,css,caching,browser,website

Problem :

I searched everywhere and I can only find solutions that I do not understand (I am not really skilled in web development).

If I understand correctly, the best method is the versionning of javascript and css calls. But I don't understand how I am supposed to implement this in my website or server.

Would someone have an idea or a link for a beginner like me? (the easiest method is the best for me I suppose)

Right now my users have problems with the website, but all problems vanish when the cache is cleared. It's a big problem.

Thanks anyway guys. Have a nice day.



Solution :

Simply add a new parameter to the end of the file every time you update it, eg

<script src="http://www.example.com/javascript.js?reload=1">

and

<script src="http://www.example.com/javascript.js?reload=2">

will both be treated as different files, despite actually being exactly the same..

If you need it never to cache, then change the parameter dynamically every page load using a script (adding a timestamp is the usual approach as that will never get accidental repeats).


    CSS Howto..

    How to force li elements to scroll horizontally and should be able to accommodate all the li elements in only one single line using css

    How to have a textbox with label inside it support 'tap to paste' feature in iPad?

    How do I apply CSS styling to a
    block?

    How to apply CSS on texte label beside an input?

    How to write CSS for parent DIV needing height dictated by child DIVs that are also anchored bottom?

    How to remove an elements active state when a sub element is clicked

    How to create CSS/JavaScript circles grid

    How to add colour classes to this css

    How do I correct overlapping spacing error in CSS when it wraps text?

    How to set color of the Button with jQuery UI?

    How to handle alternating rows dynamically?

    How to Link to Images in CSS file in RoR 3.2 Project?

    HSS Liquid Layout Issue: how to fill the entire browser

    How can I style a JavaFX SplitMenuButton in CSS

    How to insert CSS code into a page if I can't insert it into head tag? Only inline mode?

    CSS: On hover show and hide different div's at the same time? [duplicate]

    How to create a layout with 2 menu bars in css?

    How to create column with two divs one fixed above second that hides behind first when scrolling?

    How to identify is a blog post has been selected or not?

    How to align text differently inside a single inline element with CSS?

    how can I hide empty cells in a table with bootstrap 3

    How to inherit the background color of textarea from parent element in Internet Explorer?

    How can I make the text stop moving when one DIV opens?

    How to give the a specific background color in CSS?

    How to make div scroll down with a page once it reaches top of page?

    How to structure a Grunt task for develop and release

    How to download Jquery if link only shows source code and connect it to my html

    how to put image on button? (css)

    How to add css to a div once it hits the top of the page (when scrolling)?

    How to stop CSS element style from getting into my class style?