Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a url query string to jump to page sections

The standard tutorials teach how to use the hashtag and the anchor name to link to page sections, like so:

<li><a href="#section2">Section 2</a></li>

<h1>Title</h1>

<a name="section1"></a><h2>Section 1</h2>
<p>Blah bla bla bla bla.</p>

<a name="section2"></a><h2>Section 2</h2>
<p>Blah bla bla bla bla.</p>

How do I make a page jump where I can embed the link to the page section using a fully qualified url? For example:

<a href="http://www.mydomein.com/page1?section=section2">Please read section 2</a>

The application is a signup notification email.

like image 936
TARKUS Avatar asked Oct 08 '13 11:10

TARKUS


People also ask

How to pass parameter in a URL?

Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&".

How to separate variables in URL?

URL parameters are made of a key and a value, separated by an equal sign (=). Multiple parameters are each then separated by an ampersand (&).

What is a Parameterized 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 (&).


1 Answers

Using your example, the link would be:

<a href="http://www.mydomein.com/page1#section2">Please read section 2</a>

Also note that the <a name="section2"></a> is superfluous. You could simplify to

<h2 id="section2">Section 2</h2>
like image 142
André Dion Avatar answered Oct 02 '22 10:10

André Dion