I am developing an app using HTML + JavaScript + CSS with Cordova. This app uses SVG images to better suit the different resolutions, but I run into a problem: although the images are displayed well on my computer and in the android emulator, when I install the app on a device, the SVGs do not come.
I guess it has to do with the version of the device I'm using that will not support SVG (android 4.1 Jelly Bean); but obviously I'm not interested in my app seeing no graphics.
I tried to see if the problem was that SVG was not supported by my version of Android but the following code ( obtained from CSS tricks ):
document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1");
returned true
which means that SVG is supported. Also, putting the images in a img
made them work (I have tried several different routes, the one in the CSS below is correct and works in the emulator and in the browser)
I tried Blonfu's suggestion and that also helped me realize that the problem is not the format of image (fails with SVG and PNG), but something different. Maybe some CSS property that causes some kind of conflict and fails on Android.
This is the CSS (the previous one was a minimal version):
#answers .option1::before {
content:"";
position:absolute;
height:15vh;
width:15vh;
top:-2.5vh;
left:0;
background:url("../img/icon1.svg");
background-size:contain;
background-repeat:no-repeat;
}
But there is still no background image displayed on the device (while it is displayed on the emulator and browser).
What is wrong, why can not I see the image and how can I solve it?