我正在尝试编写代码(chrome扩展)来打开任何页面而不加载图像以提高性能。这是我正在使用的当前方法。
$(win.document).find("#img-selector")[0].style.visibility="hidden"
这是有问题的,因为:
铬设置中有选项可以关闭图像https://ccm.net/faq/28061-google-chrome-disable-the-display-of-images-files screen
但也许更好的解决方案是在页面顶部添加带有<style>
规则的img{visibility: hidden!important;}
元素,因此样式引擎会更快地处理这个问题吗?