Giter Site home page Giter Site logo

Comments (12)

mathieuhays avatar mathieuhays commented on July 19, 2024 1

@rachelnabors you could load the script dynamically with JS using the same test as svg4everybody.

<script type='text/javascript'>
(function(d,s,p){
    if(/Trident\/[567]\b/.test(navigator.userAgent)||(navigator.userAgent.match(/AppleWebKit\/(\d+)/)||[])[1]<537){
        var _s=d.createElement(s),
            _r=d.getElementsByTagName(s)[0];

        _s.async=1;
        _s.src=p;

        _r.parentNode.insertBefore(_s,_r);
    }
})(document,'script','your-path/svg4everybody.min.js');
</script>

I didn't test the code in IE but if you inline it in your html it should do the trick.

from svg4everybody.

 avatar commented on July 19, 2024

The script already checks the browser for that, so there is no need to load it conditionally.

The problem is that it cannot detect all the affected browsers, and depending on the user agent is highly unreliable anyway.

from svg4everybody.

rachelnabors avatar rachelnabors commented on July 19, 2024

Hmm, I was trying to reduce an HTTP request for browsers that don't need
this.

On Thu, Apr 9, 2015 at 1:49 PM János Erdei-Csóka [email protected]
wrote:

The script already checks the browser for that, so there is no need to
load it conditionally.

The problem is that it cannot detect all the affected browsers, and
depending on the user agent is highly unreliable anyway.


Reply to this email directly or view it on GitHub
#50 (comment)
.

from svg4everybody.

 avatar commented on July 19, 2024

That's great but I don't think you should rely on svg4everybody, unless you change it to always inline your SVG content.

If you use SVG for icons you are much better off with Grunticon or any other solution that embeds the SVG in CSS. Which by the way is even better if your goal is to reduce the number of HTTP requests.

from svg4everybody.

rachelnabors avatar rachelnabors commented on July 19, 2024

It's an interactive piece, and for that reason, a number of SVGs must be
physically present on the page.
On Thu, Apr 9, 2015 at 2:11 PM János Erdei-Csóka [email protected]
wrote:

That's great but I don't think you should rely on svg4everybody, unless
you change it to always inline your SVG content.

If you use SVG to display icons you are much better off with grunticon
https://github.com/filamentgroup/Grunticon or any other solution that
embeds the SVG in CSS. Which by the way is even better if your goal is
reducing the number of HTTP requests.


Reply to this email directly or view it on GitHub
#50 (comment)
.

from svg4everybody.

jonathantneal avatar jonathantneal commented on July 19, 2024

@Vorzard, same question about SVGs in a sprite map. Can you style them via CSS with grunticon? I think the target of grunticon is different. They're both awesome, but just target different scenarios. This project is more about using SVG capabilities than just loading vectors as images.

from svg4everybody.

deantpt avatar deantpt commented on July 19, 2024

Wouldn't it be better to use moderniser to do the checking for capabilities ?

On 9 Apr 2015, at 23:08, Jonathan Neal [email protected] wrote:

@Vorzard, same question about SVGs in a sprite map. Can you style them via CSS with grunticon? I think the target of grunticon is different. They're both awesome, but just target different scenarios. This project is more about using SVG capabilities than just loading vectors as images.


Reply to this email directly or view it on GitHub.

from svg4everybody.

rachelnabors avatar rachelnabors commented on July 19, 2024

I took a look at modernizr, but it doesn't have a way to check for ,
nor does it sniff browser versions.

On Thu, Apr 9, 2015 at 3:34 PM deantpt [email protected] wrote:

Wouldn't it be better to use moderniser to do the checking for
capabilities ?

On 9 Apr 2015, at 23:08, Jonathan Neal [email protected] wrote:

@Vorzard, same question about SVGs in a sprite map. Can you style them
via CSS with grunticon? I think the target of grunticon is different.
They're both awesome, but just target different scenarios. This project is
more about using SVG capabilities than just loading vectors as images.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#50 (comment)
.

from svg4everybody.

 avatar commented on July 19, 2024

@rachelnabors

If you use svg4everybody as it is currently only a couple of WebKit browsers wouldn't work, such as Safari 7.0, and some of those less popular smartphone browsers. The problem is that future Internet Explorers will require intervention. The bigger problem is that under some network conditions svg4everybody would not be able to rely on the user agent.

Grunticon also has the same capability as svg4everybody, but for an interactive content it wouldn't be any better.

from svg4everybody.

fvsch avatar fvsch commented on July 19, 2024

@Vorzard Do you know of specific svg4everybody bugs with Safari 7? I remember it working fine in my tests. Also the script has UA sniffing for versions below 7 (AppleWebKit < 537).

from svg4everybody.

 avatar commented on July 19, 2024

@fvsch See #39.

from svg4everybody.

jonathantneal avatar jonathantneal commented on July 19, 2024

With Edge holding out, conditional comments is simply not the way to conditionally load this script. You would unfortunately be better off using a loader and perhaps combining that with a list of user agent sniffs.

from svg4everybody.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.