if(window.innerWidth) { return window.innerWidth; } return $(window).width();
I use the code above to find the available webpage width. He works most of the time. But in some mobile browsers (Mobile Chrome and several), and sometimes on the desktop on the desktop, it returns 0. I donβt know what went wrong?
Mozilla / 5.0 (Linux, Android 5.1.1, SM-J500M Build / LMY48B) AppleWebKit / 537.36 (KHTML, e.g. Gecko) Chrome / 56.0.2924.87 Mobile Safari / 537.36
This is one of the user agents where it does not work. This mainly happens on mobile Chrome in the Android browser.
javascript jquery android google-chrome
kannanrbk
source share