How to create permalinks on particular position for web pages?
I don't know whether I am asking utter foolishness. I have a webpage, say http://www.example.com
. One of its page is /test.html
. It has the following layout:
Title Here
First sub heading here
lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vestibulum dolor sit amet ultrices rhoncus. Nunc at arcu eget libero auctor sodales. Morbi tristique tincidunt consequat. Donec vitae ipsum ac ligula ornare ornare eu et mi. Morbi iaculis risus ut dolor aliquam sodales. Aliquam tempor elit non tincidunt rutrum. Curabitur quis lacus at eros suscipit accumsan. Sed sit amet laoreet metus. Donec ligula lacus, vestibulum eu facilisis sit amet, malesuada a magna. Nulla sit amet malesuada augue. Nam maximus rhoncus placerat. Cras vestibulum erat in eros sodales, eu luctus elit maximus.
Second sub heading here
lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vestibulum dolor sit amet ultrices rhoncus. Nunc at arcu eget libero auctor sodales. Morbi tristique tincidunt consequat. Donec vitae ipsum ac ligula ornare ornare eu et mi. Morbi iaculis risus ut dolor aliquam sodales. Aliquam tempor elit non tincidunt rutrum. Curabitur quis lacus at eros suscipit accumsan. Sed sit amet laoreet metus. Donec ligula lacus, vestibulum eu facilisis sit amet, malesuada a magna. Nulla sit amet malesuada augue. Nam maximus rhoncus placerat. Cras vestibulum erat in eros sodales, eu luctus elit maximus.
What I am looking for is a URL which directs the user straight to the second sub heading. Something like http://www.example.com/test.html#Second_sub_heading_here
. Is it possible to do this? What all things should I read to understand about permalinks?
Edit: I am looking for a solution from user end. That is, the user visits the web page and he wants to make a permalink to direct his friends to that exact portion of the page.
Unless the page provides links (like, for example, Wikipedia does for most articles: example, titled "Contents"):
id
attribute, or an a
/ area
element with the name
attribute (which would have to be near the element that should be linked to). #
(or replacing it if already such a fragment exists). (There might be browser extensions that make finding these attributes, or even generating a link, easier. You could ask for them on Software Recommendations SE.)
If there are no such attributes for the element in question, linking to it is not possible, unless we talk about additional software installed on user's end (eg, an extension implementing XPointer), in which case these links would not work for users without this software.
If you want permalinks to be able to link to several points on your page, do well to give each one an id.
eg.
<div id="first">
<p>
to link to second Id <a href="#second">go to second Div</a>
</p>
</div>
<div id="second">
<p>
You'd arrive here. To go to the first, use <a href="#first">Return to
the First One</a>
</p>
</div>
链接地址: http://www.djcxy.com/p/88584.html
上一篇: Bootstrapvalidator在select2.js上不起作用
下一篇: 如何在网页的特定位置创建永久链接?