Refresh page on resize with javascript or jquery

html, javascript, jquery

Solution

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();});

Problem

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

Original source

Related problems