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

Safari 9 < 9.1.1 / Mobile Safari 9 < 9.3.2 download external svg sprite file for every <use> xlinks:href instance #21

Open
bjankord opened this issue Apr 21, 2016 · 2 comments
Labels

Comments

@bjankord
Copy link

This was originally posted by @codecandies on the svg4everybody repo. Copying it to here for posterity.

In this testcase http://phpscripts.zeit.de/svg-use-testcase/ you can see the problem, by loading and examining it with Chrome and a Safari greater 9 (exact version mentioned on the testcase). The problem is also seen in iOs safari, since 9.2 i guess (inspected with Charles proxy).

The problem

For every combination of the code

<svg class="svg-symbol" role="img" aria-labelledby="title">
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="icons.svg#svg-search"></use>
</svg>

the svg file icons.svg is (re-)downloaded by safari/mobile safari browsers. Additionally the file is not cached in the browser or ever served from cache, and the developer tools see this file not as image/svg+xm but as other.

This leads to extreme high content downloads, which, especially on mobile, is not good.

A bug has been logged to webkit: https://bugs.webkit.org/show_bug.cgi?id=156368

@martinwolf has documented the issue in detail here: https://www.youtube.com/watch?v=OAbmDlnq1UE

Screenshots from the network panel from Chrome v50 compared with Safari v9.1:

chrome-version50

safari-version9 1

@hexalys
Copy link

hexalys commented Apr 23, 2016

Slightly aside from this issue:
For those interested in a server side alternative to svg4everybody.
You may want to have a look at: http://codepen.io/hexalys/details/epErZj

That can fix, or at least bypass, the Safari 9 to 9.3 bug, employing the same technique as for Webkit < 537 and IE/Edge < 13.

Not sure I will target those UAs myself yet with this method. Probably depends on when the fix is deployed, and whether it affect both iOS and Desktop... But it can be of help with this particular issue.

@maddesigns
Copy link

This bug is fixed in the newest Safari version 9.1.1 for OSX and 9.3.2. for iOS.

@emilbjorklund emilbjorklund changed the title Safari 9+ / Mobile Safari 9+ download external svg sprite file for every <use> xlinks:href instance Safari 9 < 9.1.1 / Mobile Safari 9 < 9.3.2 download external svg sprite file for every <use> xlinks:href instance Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants