Custom Attributes

Although the most commonly used attributes for linking to other resources are href and src, JavaScript can and does make use of any other number of custom attributes based on the requirements of the script author. The example <img> element below includes a standard src attribute, but also includes a custom data-original attribute with an alternative image. This paragraph also includes a custom data-original attribute.

Background

If your crawler supports XPath, you could use the expression //img/@data-original to match the attribute in the above image. The expression //p/@data-original to match the attribute in the paragraph. Or you could use the expression //*/@data-original to match the attribute on both elements, and any other element.

An example expression for the above input element could be //input[@type='text'][@disabled][@value].

Learn More