What I'm looking for is quite simply, a way to automatically redirect the user to a different URL when the screen or window width is less then 950px.

I don't want to use "refresh" as it's not recommended, and I don't do want to use "User Agent" either as it seams to me less reliable in the long term and I don't want to be concerned with updating this.

This is the Script I see suggested everywhere for this purpose but for some reason it doesn't do anything:

```
<script type="text/javascript">
  <!--
  if (screen.width <= 950) {
    window.location = "https://www.google.com/";
  }
  //-->
</script>

```

I've also tried it with all this variants with no success:

```
window.location
document.location
window.location.href
document.location.href

```

I've also tried placing it as the first thing after Head tag and even before Doctype. Nothing happens...