Posted By

tmmyy on 03/15/11


Tagged

css refresh reload


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

jackkeller
rbulgueroni
pedromagalhaes


CSS Reload


 / Published in: jQuery
 

Not mine. Don't remember source.

  1. $(document).bind('keydown keyup', function(ev) {
  2. var ctrlkey = false;
  3. ctrlkey = ev.ctrlKey;
  4. if(ev.type == 'keyup' && ctrlkey) {
  5. if(ev.keyCode == 82) {
  6. reloadStylesheets();
  7. }
  8. }
  9. });
  10.  
  11.  
  12. function reloadStylesheets() {
  13. var stylesheets = $('link[rel="stylesheet"]');
  14. var reloadQueryString = '?reload=' + new Date().getTime();
  15. stylesheets.each(function () {
  16. this.href = this.href.replace(/\?.*|$/, reloadQueryString);
  17. });
  18. }

Report this snippet  

You need to login to post a comment.