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 vertically center a child element of arbitrary size inside a floated parent element (of known size)?

    How to remove space from top of web page

    How to toggle a separate drop down beneath a grid of items using JQuery?

    how to position a div below an absolute div in css

    Space on Navigation right and left…how to remove it?

    How to modify this JQuery CSS into my view?

    How to specify max-height css property to Screen size

    How do I style the asp.net membership control with css?

    How do I style all anchor tags inside a certain div?

    CSS: Background in front of image - how to prevent it?

    SVG, how to evaluate the property of the svg object

    How to justify 4 divs in one row [duplicate]

    How to create a sliding navigation with either jquery or css? [closed]

    How do i get the submenus to show with a small window size?

    image shows ui-button over the button image

    How to write css fallbacks for vh vw

    How can i return a navmenu button to previous style after clicking another button

    How to make custom shape div, or manipulate divs

    how to make a image in div to be dragged just downwards using html5 css jquery animation?

    how to give no-more-use of css in jquery for css params

    How to make agile layout?

    How to make a CSS bar go from right to left?

    How to display only the
      that has a selected
    • in it, including all of the
    • s in that parent ul, not just the selected ones?

    How to repeat a CSS shape horizontally?

    How can i make this border to the end?CSS

    How do I create a full-width bar on a web page?

    Showing refresh button when animation is complete?

    how to align vertically a dynamic-height div inside another fixed height div

    How to make an inline element appear on new line, or block element not occupy the whole line?

    How to set multiple css using jquery animate function