Compatible with Leverage browser caching
-
Hello,
When we enable Leverage browser caching, your plugin does not work well. Because it is cached. So we have to add a random number to your link. Below is what we do
Change the woocompare.js file
$(document).on('click', '.product a.compare.added', function (ev) { ev.preventDefault(); /* customize */ var rand = Math.floor(Math.random() * 1000000); var href = this.href; var rand_pos = href.indexOf('random'); if( rand_pos != -1 ){ var arr = href.split('random'); href = arr[0] + 'random=' + rand; } else{ href += '&random=' + rand; } $(this).attr('href', href); /* end customize */ var table_url = this.href; if (typeof table_url == 'undefined') return; $('body').trigger('yith_woocompare_open_popup', {response: table_url, button: $(this)}); });Change the class.yith-woocompare-frontend.php file
$url_args = array( 'action' => $this->action_view, 'iframe' => true, 'random' => rand(0, 1000000) /* Customize */ );I hope you can update your plugin. So we will not need to change your plugin file when updating it.
Thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Compatible with Leverage browser caching’ is closed to new replies.