url redirection - JavaScript confirm redirect not working -


i have following:

<script>     function dosomething() {         if (confirm("are sure?")) {             window.location = "http://www.google.com";         }     } </script>  <button onclick="dosomething();">action!</button> 

i expect when user clicks button, page ask them if there sure, , if click ok, redirect them google. however, nothing seems happen. doing wrong?

edit:

if matters, i'm running mvc 4 debug mode in vs2012.

function dosomathing(){   if (confirm("are sure?")){    location.replace("http://www.msn.com");     } 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -