I don't find a way in JavaScript to get on what device my website is open.
I want something like this:
if ( website.size < 768px) {
//do something for mobile
}
I know that I can use a media query in CSS, but I want use JS, and I'm very curious if it's possible without CSS.
window.matchMedia
or window.width
don't seem to work because they take the size of my window.
In difference on the related question is this case is to make a responsive website. So, the related answer doesn't resolve the case where the user resize the window in computer.