Embera icon indicating copy to clipboard operation
Embera copied to clipboard

Add an option for iframe lazyloading

Open jimblue opened this issue 1 year ago • 1 comments

Support for native iframe lazy loading is now pretty good : https://caniuse.com/loading-lazy-attr

This can be handled with a filter:

$embera->addFilter(static function ($response) use ($loading) {
            if (!empty($response['html'])) {
                $response['html'] = str_replace('<iframe', "<iframe loading=\"{$loading}\"", $response['html']);
            }

            return $response;
});

But IMO, it would be nicer to add a loading option to set this attribute when using autoEmbed(). Everyone should enjoy the joy of iframe lazyloading 😸

jimblue avatar Nov 19 '23 01:11 jimblue

Hi @jimblue Thanks for the suggestion. I'll be adding this as a config option on the next major release of this library.

mpratt avatar Mar 13 '24 01:03 mpratt