I need what I hope is a very simple script - if a particular screen width is detected, ask the user if they want to go to the mobile site. If they say yes (Ok button), take them there, if they click Cancel, don't do anything.

I haven't been able to find an example of this, or even similar code that I could tweak (I'm too noob).

Can someone help me with this?

We were previously redirecting people automatically but had a few reports of it malfunctioning, so I want to make it optional. This is what we had before:

if (screen.width <= 1300) {