Skip to content

Instantly share code, notes, and snippets.

@gayanvirajith
Created August 30, 2014 13:53
Show Gist options
  • Save gayanvirajith/a9213a30cfbdb2e6e473 to your computer and use it in GitHub Desktop.
Save gayanvirajith/a9213a30cfbdb2e6e473 to your computer and use it in GitHub Desktop.
Bypass the cache for mobile and tablet-devices
var nocache = $.cookie('nocache');
if($(window).width() < 768) {
if(nocache === null) {
// set nocache cookie to bypass ProCache
$.cookie('nocache', 1, { path: '/' } );
// do a redirect back to current page to bypass ProCache
window.location.href = './';
}
} else if(nocache != null) {
// re-enable ProCache as window width >= 768
// delete the cookie
$.cookie('nocache', null, { path: '/' } );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment