Easy way to find nearest text anchor in HTML page?

I have frequently felt the need to provide URL links to portions of text well within a long web page. Often, the authors of those pages helpfully include HTML anchors within the text that you can add to an URL (preceded by a #).

Is there a way I can easily find the nearest such anchor if the author doesn’t provide any obvious hint to their existence, let alone their location? The only way I’ve found to do it is to manually view the page’s source HTML myself, which is not always very easy.

Are there any easier ways?

I’m not sure why you would find it hard to view the HTML source code. That’s a pretty straightforward operation.

Anyway, if you want to find anchors without viewing source code, and you’re using the Firefox browser, there’s a very easy solution. Install the Web Developer extension, and once it’s installed, open the toolbar and select Information > Display Anchors.

Voila! All the anchors will be displayed in yellow on the page…

Perfect.

Thank you!

Oh, viewing the source is easy. What I found difficult was locating all the anchors therein. Especially in machine-generated HTML.

But your solution puts an end to that.

Why couldn’t you just have searched on “<a”?

(1) There are usually plenty more links than anchors, which would end up wasting time on useless “finds”. I’ve performed just such searches in html documents which contained hundreds of "<a"s.

(2) Human parsing of machine-generated document files is not only highly error-prone, it is exactly the sort of thing that computers are supposed to do to take the drudgery out of human work in the first place.

On this page you’re reading, as an example, there are at least 125 links, both external and internal anchors. And with every new post more get added. That’s a lot to search through using the ctrl-f method.