Categories
javascript mobile

Use A JavaScript Confirm Dialog To Give Users Option Between Mobile or Desktop View

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.

[code lang=”js” autolinks=”false” classname=”codeClass” collapse=”false” firstline=”1″ gutter=”true” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″]

window.onload = function(){
setTimeout(confirmMobile, 3000);
}

function confirmMobile(){
One of the troubles sildenafil side effects that have been leading from past ancient making the men’s life miserable is erectile dysfunction. Interestingly, it has helped thousands of men in the UK alone suffer from erectile dysfunction viagra australia price get the help of this medication. Not taking foreplay seriously energyhealingforeveryone.com viagra no prescription To start sex you need to feel every touch and sensation which your partner gives you. This medicine contains the synthetic of Sildenafil citrate. http://www.energyhealingforeveryone.com/gcp/GCS.pdf canadian cialis var toView = window.confirm("View Mobile Version?");
if (toView){
window.location.replace("http://m.yahoo.com");
}
}

[/code]
Tested on iOS 4+ and Android 2.3.4+