Greasy Fork

Greasy Fork is available in English.

手动加载 <iframe>

默认不载入面积较大的 <iframe> 元素,减免一部分不必要的资源消耗。不是 lazyload;点击按钮(而不是点击 <iframe> 的任意位置)才会加载,以免误触。

目前为 2020-12-09 提交的版本。查看 最新版本

作者
Crystal-RainSlide
评分
0 0 0
版本
1.3
创建于
2020-10-05
更新于
2020-12-09
大小
2.4 KB
许可证
暂无
适用于
所有网站

It's main purpose is to reduce some unnecessary resource consumption caused by s, not block every <iframe> based share buttons (add some social-blocking rulesets into your AdBlocker to block the share buttons) or visualize the existence of every <iframe>s. So expect it to ignore lots of <iframe>s but only seems to suspend the embed YouTube videos.</p> <p>will ignore <iframe>s that:</p> <ul> <li>has <code>srcdoc</code> attribute</li> <li>doesn&#39;t have <code>src</code> attribute</li> <li>the value of its <code>src</code> attribute is not a valid URL</li> <li>the URL of its <code>src</code> attribute: <ul> <li>has a origin that is <code>&quot;null&quot;</code>, and/or</li> <li>has a protocol that is not <code>&quot;https:&quot;</code> or <code>&quot;http:&quot;</code></li> <li>(in other words, is <code>&quot;about:blank&quot;</code>, <code>&quot;javascript:*&quot;</code> or <code>&quot;data:*&quot;</code>)</li> </ul></li> <li>narrower than 72px, or generally smaller than 128x128px</li> </ul> <p><strong>Just modify the code to change the behavior.</strong> If you need a lazyload version, but can&#39;t code it yourself, I&#39;m glad to say now you can do this by just set <code>loading=lazy</code> attribute to the <code>&lt;iframe&gt;</code> (<a href="https://web.dev/browser-level-image-lazy-loading/" rel="nofollow">and <code>&lt;img&gt;</code></a>) elements, for the newest modern browsers:</p> <ul> <li>https://web.dev/iframe-lazy-loading/</li> </ul> <p>And there are some lazyload libs for reference, for older browsers. Here is one of them:</p> <ul> <li>https://github.com/ApoorvSaxena/lozad.js</li> </ul>