How to create permalinks on particular position for web pages?

安稳与你 提交于 2019-12-02 08:13:22
unor

Unless the page provides links (like, for example, Wikipedia does for most articles: example, titled "Contents"):

  1. The user would have to inspect the HTML and look for an id attribute, or an a/area element with the name attribute (which would have to be near the element that should be linked to).
  2. The user would have to append the value of this attribute to the current URL, prefixed by a # (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 (e.g., 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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!