HOW TO link directly to a certain part of a web page that you don't own

This trick works only if the HTML container of the portion of the web page that you wish to link to has an ID attribute.

Generally, "named anchors" can be coded to allow jumping to links within the same page when you own those pages.

Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.

The upcoming HTML5 standard suggests using the id attribute instead of the name attribute for specifying the name of an anchor. Using the id attribute actually works also for HTML4 in all modern browsers.

Now what if you were reading an long article on a site you don't own & wanted your friend to read only a specific portion that's interesting. As I discovered from this answer on the WebApps StackExchange forum, you can append the "id" of the HTML element that contains the interesting portion to the URL after preceding it with a hash.

This trick assumes that the portion of the page that's of interest is within a HTML element like p(ara) or div tag and is uniquely identified through an ID attribute. To check this, you have to scan the HTML source (Developer tools that come natively with browsers or Firebug or the View Selected Source option in Firefox can let you easily jump to a specific element) of the webpage that you want to link to and see if the container of interesting material has an ID

Let us say, I wanted to share a link that specifically explains what a "Fold-in" is. Rather than share the link to the Wikipedia article (http://en.wikipedia.org/wiki/Al_Jaffee) about the inventor of the "Fold-in", Al Jaffee, I can directly send you to the description of the "Fold-in" within that article -
http://en.wikipedia.org/wiki/Al_Jaffee#The_Fold-In

Comments

Popular posts from this blog

Maven Crash Course - Learn Power Query, Power Pivot & DAX in 15 Minutes

"Data Prep & Exploratory Data Analysis" course by Maven Analytics

Oracle Cloud Infrastructure 2024 Generative AI Professional Course & Certification Exam (1Z0-1127-24)