Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

269
Vistas
why `location.search` contains `?` and an empty string when no query string part

In general, if the url is https://www.stackoverflow.com?a=1, location.search is ?a=1

if there's no query string part, the location.search will return an empty string not '?'

why design like so

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is what the HTML spec says about location.search:

The search getter steps are:

  1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
  2. If this's url's query is either null or the empty string, return the empty string.
  3. Return "?", followed by this's url's query.
about 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda