Giter Site home page Giter Site logo

Android support about svg4everybody HOT 9 CLOSED

jonathantneal avatar jonathantneal commented on July 19, 2024
Android support

from svg4everybody.

Comments (9)

 avatar commented on July 19, 2024

+1

from svg4everybody.

milanstosic avatar milanstosic commented on July 19, 2024

+1

from svg4everybody.

mattcav avatar mattcav commented on July 19, 2024

+1

from svg4everybody.

rarkins avatar rarkins commented on July 19, 2024

The parsing required to be sure it's Android Browser and not Chrome is complex. I found that this works:

var navU = navigator.userAgent;
// Android Mobile
var isAndroidMobile = navU.indexOf('Android') > -1 && navU.indexOf('Mozilla/5.0') > -1 && navU.indexOf('AppleWebKit') > -1;
// Android Browser (not Chrome)
var regExAppleWebKit = new RegExp(/AppleWebKit\/([\d.]+)/);
var resultAppleWebKitRegEx = regExAppleWebKit.exec(navU);
var appleWebKitVersion = (resultAppleWebKitRegEx === null ? null : parseFloat(regExAppleWebKit.exec(navU)[1]));
var isAndroidBrowser = isAndroidMobile && appleWebKitVersion !== null && appleWebKitVersion < 537;

from svg4everybody.

chriscoyier avatar chriscoyier commented on July 19, 2024

This is pretty tricky I would think. In a quick test with <use> with an external source, android 4.0, 4.1, and 4.2 failed, but 4.4 worked. So the browser sniff would have to be extra fancy. Plus then there is android 2.3 where inline SVG isn't going to work at all, which is a different scenario.

from svg4everybody.

bonfish avatar bonfish commented on July 19, 2024

I believe this check would do for Android 4.1 - 4.3 (couldn't test it in 4.0.x)

var isWebkit = 'WebkitAppearance' in document.documentElement.style,
    isChromium = !!window.chrome,
    isSafari = /constructor/i.test(window.HTMLElement);

var isJellyBean = isWebkit && !isChromium && !isSafari

from svg4everybody.

jenshedqvist avatar jenshedqvist commented on July 19, 2024

Hmm, it does kind of work actually. Im inlining the SVG spritemap (using adapted version of the localstorage solution for webfonts).

It then renders fine in my local dev environment (xx.xx.xx.xx:4567) in Android 4.1.2 (Nexus S) and 3.2.1 (ancient tablet of horror) with the minor flaw that fill="currentColor" doesn't work so the icons are black.
But it doesn't work in test environment on Heroku. The same behaviour can be emulated with Chrome dev tools setting device to "Samsung Galaxy S III, Nexus". It works locally but not on Heroku.

from svg4everybody.

jonathantneal avatar jonathantneal commented on July 19, 2024

Parsing for WebKit < 537 had been added, and will be even better in 2.0

from svg4everybody.

sonicpunk avatar sonicpunk commented on July 19, 2024

Has Android 4.2 and 4.3 been taken care of? I still get issues with svg4everybody Version 2.0.0

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.