Specifying additional URL-valued attributes

Authorizing and Mapping Urls and Domains

All PageSpeed filters that process URLs need to know which attributes of which elements to consider. By default they consider those in the HTML4 and HTML5 specifications and a few common extensions:

<A href=...> <AREA href=...> <AUDIO src=...> <BLOCKQUOTE cite=...> <BODY background=...> <BUTTON formaction=...> <COMMAND icon=...> <DEL cite=...> <EMBED src=...> <FORM action=...> <FRAME src=...> <HTML manifest=...> <IFRAME src=...> <IMG src=...> <INPUT type="image" src=...> <INS cite=...> <LINK href=...> <Q cite=...> <SCRIPT src=...> <SOURCE src=...> <TD background=...> <TH background=...> <TABLE background=...> <TBODY background=...> <TFOOT background=...> <THEAD background=...> <TRACK src=...> <VIDEO src=...>

If your site uses a non-standard attribute for URLs, PageSpeed won't know to rewrite them or the resources they reference. To identify them to PageSpeed, use the UrlValuedAttribute directive. For example:

pagespeed UrlValuedAttribute span src hyperlink pagespeed UrlValuedAttribute div background image

These would identify <span src=...> and <div background=...> as containing URLs. Further, the background attribute of div elements would be treated as referring to an image and would be treated just like an image resource referenced with <img src=...>. The general form is:

pagespeed UrlValuedAttribute ELEMENT ATTRIBUTE CATEGORY

All fields are case-insensitive.Valid categories are:

  • script
  • image
  • stylesheet
  • otherResource
    • Any other URL that will be automatically loaded by the browser along with the main page. For example, the manifest attribute of the html element or the src attribute of an iframe element.
  • hyperlink
    • A link to another page or resource that a browser wouldn't normally load in connection to this page (like the href attribute of an a element). These URLs will still be rewritten by MapRewriteDomain and similar directives, but they will not be sharded and PageSpeed will not load the URL and rewrite the resource.

When in doubt, hyperlink is the safest choice.