• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

157
Vistas
Spoof client user agent in Next.js

I have a route that redirects iPhones, but no great way to test it:

export const getServerSideProps = async ({ req }) => {
  const isIphone = req.headers['user-agent'].match(/iPhone/i);

  if (isIphone) {
    return {
      redirect: {
        ...
      }
    }
  }

  return {
    props: {}
  };
}

Is there some way one can spoof the user agent head client side? It seems that changing the navigator.userAgent property does not suffice for whatever fetch function next.js is using under the hood.

almost 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  1. Is this a question about browser tasing? If So - Safari > Develop > Enter Responsive Design Mode > Dropdown
  2. Use an iPhone emulator.

Hopefully you are not accessing using any intermediaries who add headers.

almost 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda