Whisper to me for (someprivatetime) wrote in javascript,
Whisper to me for
someprivatetime
javascript

Is this acceptable code to redirect mobile users?

After looking through many pages showing fairly large chunks of JS code (of which I am not fluent) I found this very very short code block which appears to work after a quick test from a Desktop and Mobile device. Is this good enough to use for a non-enterprise site?

<script>

if (navigator.userAgent.indexOf("Mobile") != -1) {
            window.location = "http://Domain.com/mobile.html"
            }
else {
    <!--Do nothing, remain on page-->
}

</script>


Thanks for any help! :)
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 12 comments