HTML inline attribute to prevent content rewrite?

25 views
Skip to first unread message

James Moberg

unread,
Apr 7, 2017, 10:48:35 AM4/7/17
to Support
We use a couple different javascript libraries.  One of them determines what a hover-based image filename should be named based on the original img SRC attribute.   PageSpeed rewrites the URL and then the javascript logic is unable to replace the image upon mouseover.  (NOTE: I'm using IISpeed-2.0.3 / PageSpeed 1.9.32.14.  Is there an update?  Do you have a version history anywhere?)

This IMG tag:
<img src="/home.gif">

is dynamically replaced by javascript during mouseever/hover event.

<img src="/home_f2.gif">

However pagespeed rewrites the original image to be something like:

<img src="home.gif.pagespeed.ce.LSPnEsNR56.gif"> (or totally inlines the image SRC attribute using a data url).

and then the mouse image is "404 Not Found" because the cacheable/randomized filename (with "_f2" suffix) does not exist on the web server.

I've tried the adding the following attributes to the IMG tag and nothing is able to granularily disable optimization for the image.
  • data-pagespeed-no-transform
  • pagespeed_no_transform
  • pagespeed-no-transform
  • pagespeed_no_defer
  • data-pagespeed-no-defer
What can be added to disable optimization for selected HTML elements?  I'd like for the rest of the content to be optimized, just not specific elements.  Is this possible?

Thanks.

James Moberg

unread,
Apr 9, 2017, 3:18:55 PM4/9/17
to Support
NOTE:  I ended up working around this issue by using capturing the server-side HTTP output buffer (using jsoup) and generating "data" attributes for elements.   I then modified our client-side javascript library to check for either a special class or data attribute in which to use to perform the javascript-based mouse-overs.  This made it possible for PageSpeed to re-modify the HTML code without impacting our ability to identify the initial image "SRC" attribute.

I'd still like to know if there's any embedded code that can be added to prevent pagespeed from performing image rewrites, lazy loading, etc.
Reply all
Reply to author
Forward
0 new messages