Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper URL forming with a query string and an anchor hashtag

People also ask

What is the use of hashtag in query?

In a URL, a hash mark, number sign, or pound sign ( # ) points a browser to a specific spot in a page or website. It is used to separate the URI of an object from a fragment identifier. When you use a URL with a # , it doesn't always go to the correct part of the page or website.

What is anchor query?

AnchorQuery™ is a specialized pharmacophore search technology that brings interactive virtual screening of novel protein-protein inhibitors to the desktop.

What is a parameter in a URL?

URL parameter is a way to pass information about a click through its URL. You can insert URL parameters into your URLs so that your URLs track information about a click. URL parameters are made of a key and a value separated by an equals sign (=) and joined by an ampersand (&).


?var=var#hash

Everything after # is client side.

Also, look into URL rewriting to get rid of ugly ?var=var.


? should come before the # as noted in RFC 3986:

relative-ref = relative-part [ "?" query ] [ "#" fragment ]

Taken from an answer over at Super User (Does an anchor tag come before the query string or after?):


Note that when the URL has both anchor tags (#) and query strings (?), the browser may ignore the query string and navigate to the anchor tag without reloading the page.

It may be necessary to submit the page using a

<form action='webpage.php?q=string#tag' method='GET or POST'>
    <input type='text' id='q' name='q' value='string'>
    <input type='submit' value='submit'>
</form>

rather than just a URL link

<a href='webpage.php?q=string#tag'>.

If the intention of using # is to denote a page fragment then - yes ? and then #.

If # is coming before ? and it is not to denote a page fragment (this can happen when # is part of authority (username and password)) it has to be encoded or you are in trouble. The same applies to any other special characters (:,@,...) that could give a different meaning to the URL.