URL with question mark and without

  • Thread starter Thread starter sammie194
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the differences in browser behavior when accessing URLs with and without a question mark, specifically focusing on the implications of query parameters in web requests. The scope includes technical explanations and conceptual clarifications related to web protocols.

Discussion Character

  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • Some participants propose that the question mark in a URL indicates the beginning of query parameters, which allows data to be passed to the web server.
  • Others argue that appending only a question mark without any parameters may not yield useful results and could potentially lead to an error response.
  • A later reply explains that when a URL is entered without a query string, the browser sends a standard HTTP GET request, and the server responds with the web page's HTML markup.
  • Some participants express that the presence of a question mark is unnecessary if no query parameters follow it.

Areas of Agreement / Disagreement

Participants generally agree on the role of the question mark in indicating query parameters, but there is some uncertainty regarding the implications of using a question mark without parameters and its effect on browser behavior.

Contextual Notes

There are limitations in the discussion regarding the specifics of how different web servers might handle URLs with and without query parameters, as well as the potential for varying responses based on server configurations.

sammie194
Messages
6
Reaction score
0
Question:

How would the action of a browser differ if you asked it to "find the document" at the URL,
http://stargazer.universer.org
as opposed to
http://stargazer.universer.org?

My attempt:

The question mark permits data to be passed from the web browser to the program which generates the web page,
so it will find the document you're asking for, in opposition to the URL without the question mark.

Is this right?
 
Physics news on Phys.org
sammie194 said:
Question:

How would the action of a browser differ if you asked it to "find the document" at the URL,
http://stargazer.universer.org
as opposed to
http://stargazer.universer.org?

My attempt:

The question mark permits data to be passed from the web browser to the program which generates the web page,
so it will find the document you're asking for, in opposition to the URL without the question mark.
Is this right?

The purpose of the question mark in the URL is to denote the beginning of what are called query parameters. Appending only a question mark as in your 2nd example won't do anything, except possibly cause an error response. For more info, see http://en.wikipedia.org/wiki/Query_string.
 
Mark44 said:
The purpose of the question mark in the URL is to denote the beginning of what are called query parameters. Appending only a question mark as in your 2nd example won't do anything, except possibly cause an error response. For more info, see http://en.wikipedia.org/wiki/Query_string.

Thank you! That makes much sense, as the query string isn't there an question mark isn't needed.
 
The way that browsers work is that when you type in a URL such as http://stargazer.universer.org and press Enter, your browser sends an HTTP (HyperText Transfer Protocol) GET request to the server. If everything goes well, it sends a 200 OK response with a body that contains the HTML markup for the web page.

If you type in the URL with a query string, code on the server processes the parameters in the query string. Everything after the ? character is the query string, which consists of key and value pairs, separated by % character, like so.
<URL>?param1=<something>&param2=<somethingelse>
 

Similar threads

  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 50 ·
2
Replies
50
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K