Automatic CSS reloading through jQuery

<img class=”size-full wp-image-180 alignleft” title=”JQuery_logo_color_onwhite-300×74″ src=”http://www.thyone.nl/wp-content/uploads/2010/03/JQuery_logo_color_onwhite-300×74.png” alt=”" width=”300″ height=”74″ />

Ja, vrij lastig voor elke developer, maar het moet toch vaak gebeuren: de CSS moet herladen worden.

Met een simpel stukje code (met dank aan jQuery) kun je met 1 klik op de knop alle CSS herladen. Let op dat sommige browsers heel snel even kunnen gaan trippen omdat ze geen CSS meer hebben, maar als je een beetje snelle pc hebt hoeft dat geen probleem te zijn.

Dit wilde ik jullie niet onthouden:

function reloadStylesheets() {
var stylesheets = $('link[rel="stylesheet"]');
var reloadQueryString = '?reload=' + new Date().getTime();
stylesheets.each(function () {
this.href = this.href.replace(/\?.*|$/, reloadQueryString);
});
}

1 Comment

  1. Clint Delosanglel
    Aug 31, 2010

    Sick of obtaining low amounts of useless visitors to your website? Well i wish to tell you about a fresh underground tactic which makes me personally $900 every day on 100% AUTOPILOT. I could truthfully be here all day and going into detail but why dont you simply check their website out? There is really a great video that explains everything. So if your serious about making easy cash this is the site for you. Auto Traffic Avalanche

Submit a Comment

thomas davisthomas davis