Question: Having trouble getting this script to run properly on an iphone 6. Keeps coming up as "not mobile". What am I missing?

```
$(document).ready(function(){
    if ($(window).width < 700){
        alert("mobile");
    }
    else {
        alert("not mobile");
    }
});

```

EDIT: apologies, the code I typed here had a typo, but was not the cause for my issue. I had inaccurate info on iphone resolution. Thanks everyone!

Answer: 
If you are using bootstrap add an element to the screen that only displays at a certain break point (bootstrap 4):

```
<div id="IsMobile" class="d-block d-lg-none"></div>

```

Then if it's visible:

```
if ($("#IsMobile").is(":visible")) {
     //Do Something...
}

```
```
function isMobileDevice() {
    return (typeof window.orientation !== "undefined") || 
        (navigator.userAgent.indexOf('IEMobile') !== -1);
}

```

This is a legacy way of checking. You should probably use something like this:

```
const isMobile = ('ontouchstart' in document.documentElement && /mobi/i.test(navigator.userAgent));

```