The idea was to use the native look of the confirm box to give the user an option between viewing the site in a mobile view or stay on current view. I used a setTimeout
method so i can have it fire 3 seconds after the pages has rendered in all its glory. The code below is pretty simple and straight forward.
window.onload = function(){ setTimeout(confirmMobile, 3000); } function confirmMobile(){ var toView = window.confirm("View Mobile Version?"); if (toView){ window.location.replace("http://m.yahoo.com"); } }
Tested on iOS 4+ and Android 2.3.4+