# How can I make the internet browser see CSS and also Javascript adjustments?

CSS and also Javascript documents do not transform really usually, so I desire them to be cached by the internet internet browser. Yet I additionally desire the internet internet browser to see adjustments made to these documents without calling for the customer to clear their internet browser cache. Additionally desire a remedy that functions well with a variation control system such as Subversion.

Some remedies I have actually seen entail including a variation number throughout of the documents in the kind of a question string.

Could make use of the SVN alteration number to automate this for you : ASP.NET Display SVN Revision Number

Can you define just how you include the Revision variable of an additional documents? That remains in the HTML documents I can include the Revision number in the URL to the CSS or Javascript documents.

In the Subversion book it claims concerning Revision : "This search phrase defines the last well-known alteration in which this documents transformed in the database".

Firefox additionally permits pushing CTRL+R to refill every little thing on a certain web page.

To clarify I am seeking remedies that do not call for the customer to do anything on their component.

0
2019-05-09 11:15:44
Source Share

When you release a new variation of your CSS or JS collections, create the complying with to take place:

1. change the filename to include an one-of-a-kind variation string
2. change the HTML documents which reference the collection to aim at the versioned documents

(this is generally a rather straightforward issue for a release manuscript)

Now you can set the Expires for the CSS/JS to be years in the future. Whenever you transform the web content, if the referencing HTML indicate a new URI, internet browsers will certainly no more make use of the old cached duplicate.

This creates the caching actions you desire without calling for anything of the customer.

0
2019-05-19 15:47:56
Source

In my point of view, it is far better to make the variation number component of the documents itself as an example myscript.1.2.3.js. You can set your webserver to cache this documents for life, and also simply add a new js submit when you have a new variation.

0
2019-05-16 23:38:20
Source

Some remedies I have actually seen entail including a variation number throughout of the documents in the kind of a question string.

<script type="text/javascript" src="funkycode.js?v1">


You can make use of the SVN alteration number to automate this for you by consisting of words LastChangedRevision in your html documents after where v1 shows up over. You have to additionally arrangement your database to do this.

I wish this more clarifies my solution?

Firefox additionally permits pushing CTRL+R to refill every little thing on a certain web page.

0
2019-05-10 05:58:50
Source

I located that if you add the last tweaked timestamp of the documents onto completion of the URL the internet browser will certainly ask for the documents when it is changed. As an example in PHP :

function urlmtime($url) {$parsed_url = parse_url($url);$path = $parsed_url['path']; if ($path[0] == "/") {
$filename =$_SERVER['DOCUMENT_ROOT'] . "/" . $path; } else {$filename = $path; } if (!file_exists($filename)) {
// If not a file then use the current time
$lastModified = date('YmdHis'); } else {$lastModified = date('YmdHis', filemtime($filename)); } if (strpos($url, '?') === false) {
$url .= '?ts=' .$lastModified;
} else {
$url .= '&ts=' .$lastModified;
}

return $url; } function include_css($css_url, $media='all') { // According to Yahoo, using link allows for progressive // rendering in IE where as @import url($css_url) does not
echo '<link rel="stylesheet" type="text/css" media="' .
$media . '" href="' . urlmtime($css_url) . '">'."\n";
}

function include_javascript($javascript_url) { echo '<script type="text/javascript" src="' . urlmtime($javascript_url) .
'"></script>'."\n";
}

0
2019-05-10 05:54:32
Source