Skip to content

Instantly share code, notes, and snippets.

@LeonardoCiaccio
Created September 8, 2017 10:46
Show Gist options
  • Select an option

  • Save LeonardoCiaccio/a63c07beed1b9203ff181827bbc93401 to your computer and use it in GitHub Desktop.

Select an option

Save LeonardoCiaccio/a63c07beed1b9203ff181827bbc93401 to your computer and use it in GitHub Desktop.
Rende un link sempre nuove quindi non restituisce la cache in una chiamata xhr
var _noCache = function( link ){
var newdata = Date.now();
if( link.indexOf( "?" ) > -1 ){
return link.replace( "?", "?" + newdata + "=" + newdata + "&" );
}else if( link.indexOf( "#" ) > -1 ){
return link.replace( "#", "?" + newdata + "=" + newdata + "#" );
}
return link + "?" + newdata + "=" + newdata;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment