Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option for iframe lazyloading #102

Open
jimblue opened this issue Nov 19, 2023 · 1 comment
Open

Add an option for iframe lazyloading #102

jimblue opened this issue Nov 19, 2023 · 1 comment

Comments

@jimblue
Copy link

jimblue commented Nov 19, 2023

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 😸

@mpratt
Copy link
Owner

mpratt commented Mar 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants