Ah, as I suspected earlier. It has to be document.ready instead of window.load. Seems to work for me, can you try it? Replace
$(window).on('load', function() { // You can try $(document).ready as well because load will delay it slightly
$('.'+tab).click();
})
with
$(document).ready(function() {
$('.'+tab).click();
}))