Created
August 30, 2014 13:53
-
-
Save gayanvirajith/a9213a30cfbdb2e6e473 to your computer and use it in GitHub Desktop.
Bypass the cache for mobile and tablet-devices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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