Skip to content

Add an option for iframe lazyloading #102

@jimblue

Description

@jimblue

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 😸

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions