Refresh the page once when media query is triggered?
问题 I want to use jQuery to trigger a page refresh, only once, when a media query has been triggered. This is how I detect my media query: function media_query(obj) { size = obj(); if (size != currentSize) { if (size == 'mobile') { location.reload(); currentSize = 'mobile'; } if (size == 'tablet') { location.reload(); currentSize = 'tablet'; } if (size == 'laptop') { currentSize = 'laptop'; } } }; $(window).resize(_.debounce(function () { media_query(mqCSS); }, 10)); $(window).load(function () {