How many times have you told a friend or colleague “Go to http://example.com/some/doc and search for XXXX” ? I do it a lot actually. Ideally web pages should identify significant sections of a web page with identifiers (id=”foo”) so that you can link to http://example.com/some/doc/#foo, but the problem is that not everyone follows this practice. In fact, there are a lot of big specification documents where you’d like to point someone to a specific paragraph to save someone time and encourage them to actually visit the link and read it. This becomes increasingly important as the mobile web accelerates and small screens with harder-to-use keyboards become more prevalent. I hope this Firefox extension will help.
Tonight I updated my Firefox extension, FXPointer, so that you can right-click on some web page text and get the XPointer element link that will drive people directly to it. This is the first time the extension comes close to being semi-usable, so I thought I should start to get the word out. It’s very similar to Doug’s excellent Idiri extension, except that FXPointer tries to use the XPointer specification for HTML documents. Thus, it will allow you to link directly to any element in a web page.
Truth be told, Firefox already supports XPointer to some degree on true XML documents. Tragically, it doesn’t work with XHTML documents (see Bug 235409). Worse yet, the amount of HTML on the web vastly outweighs the amount of XHTML, meaning that XPointer will never really reach critical mass without a boost in the HTML direction.
Anyway, I plan to start using these more-specific links going forward. If you don’t have XPointer support, you’ll just get a less-specific link. I’ll try to make improvements that degrade even more gracefully in the future.
Some future plans that may or may not transpire:
- Support for the xpointer scheme so you can use XPath and search strings (probably less brittle)
- Support for SVG’s XPointer-friendly scheme svgView
- Some configuration of the context menu
If you want to submit patches, download the .xpi, unzip it and hack away.
FXPointer does its best to use IDs where it can, so this is less brittle than it seems, but I still wouldn’t recommend this for any dynamic web pages with wildly changing DOMs. Of course the ultimate would be to support the xpointer scheme in some way such that people can use XPath and string searches.
If you think this extension is useful, please help lobby for native XPointer/HTML support in browsers.