I want to force the browser to refresh the page when the user resizes it. I have following code:
function refresh() { location.reload(); } <body onResize="refresh()">
but it does not work. Does anyone of you has a solution? Thanks
Do it with javascript/jquery:
just javascript:
window.onresize = function(){ location.reload(); }
with jquery:
$(window).resize(function(){location.reload();});
or
$(window).on('resize',function(){location.reload();});
The following code seems to work with all browsers,
$(window).bind('resize', function(e) { if (window.RT) clearTimeout(window.RT); window.RT = setTimeout(function() { this.location.reload(false); /* false to get page from cache */ }, 100); });
Hope it helps everyone. I found this information here: http://www.jquery4u.com/snippets/jquery-refresh-page-browser-resize/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With