I just installed this module and dropped a test display field into a node page via Layout.

I'm getting the following console error:

The resource ./modules/contrib/better_social_sharing_buttons/assets/dist/sprites/social-icons--square.svg was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

Comments

tonka67 created an issue. See original summary.

mably’s picture

Related article: https://geoffrich.net/posts/preloading-svgs/

Looks like the Chromium bug is not fixed yet: https://issues.chromium.org/issues/40681653

shelane’s picture

Status: Active » Postponed (maintainer needs more info)

That is interesting as I don't see any attempt from this module to preload the svg.

erwangel’s picture

Version: 4.0.7 » 4.1.0

I am encountering the same error, although the file better-social-sharing-buttons.html.twig does contain an "as" value, as claimed by the error.
@shelane: the module (4.1.10) indeed preloads the svg.

Lines 4-5:

{# --- Include svg sprite --- #}
<div style="display: none"><link rel="preload" href="{{ social_buttons_sprite }}" as="image" type="image/svg+xml" crossorigin="anonymous"/></div>

Also these lines look correctly rendered in the produced html:
<div style="display: none"><link rel="preload" href="/modules/contrib/better_social_sharing_buttons/assets/dist/sprites/social-icons--square.svg" as="image" type="image/svg+xml" crossorigin="anonymous"></div>

The "as" error is displayed by MS Edge. Firefox just states "preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly". What are other possible tags? I don't see any at developer.mozilla.org. Or, perhaps the preload link better fits in the head section instead of body.

  • shelane committed c8385183 on 5.x
    Issue #3467348 by tonka67, mably, erwangel : .svg sprite preloaded need...

  • shelane committed 1a8196f0 on 4.x
    Issue #3467348 by tonka67, mably, erwangel : .svg sprite preloaded need...
shelane’s picture

Status: Postponed (maintainer needs more info) » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.