TARKUS
TARKUS

Reputation: 2200

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.

Upvotes: 9

Views: 19700

Answers (1)

Andr&#233; Dion
Andr&#233; Dion

Reputation: 21728

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>

Upvotes: 16

Related Questions