• Support PF! Buy your school textbooks, materials and every day products Here!

URL with question mark and without

  • Thread starter sammie194
  • Start date
  • #1
6
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?
 

Answers and Replies

  • #2
33,273
4,981
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.
 
  • #3
6
0
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.
 
  • #4
33,273
4,981
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>
 

Related Threads on URL with question mark and without

  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
4
Views
832
Replies
10
Views
1K
  • Last Post
Replies
13
Views
4K
Replies
6
Views
2K
Replies
2
Views
2K
Replies
6
Views
2K
Top