Is it valid to have more than one question mark in a URL?

Posted by Bungle on Stack Overflow See other posts from Stack Overflow or by Bungle
Published on 2010-05-27T19:19:15Z Indexed on 2010/05/27 19:21 UTC
Read the original article Hit count: 278

I came across the following URL today:

http://www.sfgate.com/cgi-bin/blogs/inmarin/detail??blogid=122&entry_id=64497

Notice the doubled question mark at the beginning of the query string:

??blogid=122&entry_id=64497

My browser didn't seem to have any trouble with it, and running a quick bookmarklet:

javascript:alert(document.location.search);

just gave me the query string shown above.

Is this a valid URL? The reason I'm being so pedantic (assuming that I am) is because I need to parse URLs like this for query parameters, and supporting doubled question marks would require some changes to my code. Obviously if they're in the wild, I'll need to support them; I'm mainly curious if it's my fault for not adhering to URL standards exactly, or if it's in fact a non-standard URL.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about http