Google mod_pagespeed for ajax loaded content

最后都变了- 提交于 2019-12-13 17:39:55

问题


I`m trying to optimze and convert images using mod_pagespeed and it works very good for all tags in html files. But how could it process images that loaded with js? For example images in slideshows and etc.

Thanks!


回答1:


mod_pagespeed normally optimizes images and other resources by detecting their URL in the HTML and then replacing the URL with a link to the optimized version. As of mod_pagespeed 1.4.26.1 however, mod_pagespeed includes a feature called In-Place Resource Optimization, which allows resources requested with their original URL to be optimized. This can be used in cases like yours where images are being requested through AJAX. It can be enabled by setting ModPagespeedInPlaceResourceOptimization on in your config file, and have a look at the documentation linked above for more details.




回答2:


Google's mod_pagespeed module only parses HTML files for images, and then optimizes them. You would have to have the images loaded via the HTML file, and then referenced/shown to the client via javascript. (Have the images hidden by default).



来源:https://stackoverflow.com/questions/21076663/google-mod-pagespeed-for-ajax-loaded-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!