Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!