Add window width to URL on resize
Trying to get jQuery to add current window width to URL on resize. It keeps reloading on mobile devices. How do I solve this problem. My code looks like below.
- $(window).bind('resize',function(){
- if (window.location.href.indexOf('reload') === -1) {
- window.location.replace(window.location.href+'?reload' + ($(window).width()));
- } else {
- window.location.replace('?reload' + ($(window).width())); // With current width
- }
- });