use navigator.userAgent to detect device