SVG image not loading on smartphones unless cached - android

I have a header SVG image on my website landing page, https://www.csselectronics.com/.
This header image displays correctly on all desktop browser I've tested. However, I've recently found that it sometimes does not display at all when using a smartphone (e.g. iPhone 10, iPhone 11, Android phones).
The image simply is not loaded, though if a manual refresh is done on the page it seems to load correctly. The non-loading can then be re-triggered by clearing the image cache on the phone.
Any idea what might cause this issue?

This was the result of using negative margins on the image div container.

Related

Android WebView image displayed partly

I have a webview which opens a page that shows different images like a gallery.
The image is saved locally on an sdcard and is loaded through css with background-image: url(file://...).
This issue seems (not sure though) to be connected to Android's request for resources for some reason. The longer the OS needs resources the bigger the white (or black) band is.
This doesn't happen always in one test session and affects images randomly (in a cycle a certain image displays ok, in the next it doesn't). Also it seems to affect only images, displaying an iframe is always loaded normally.
I wouldn't have a problem if this happened for one second and then it would display normally, the problem is that the image stays like that until the next refresh of the webview.
android's version is 4.4.2. It is a mk808b plus device if any of this helps...
Any ideas on how to solve or somehow decrease the times this happens... anything really... except using imageview, I want to keep all in the webview. Any directions to follow for further debugging are also greatly appreciated.
Thank you for any help you can provide.
If it is possible I would try converting background images to a vectorial format (like SVG). Rendering should be easier and less memory hungry.

The behavior of animated gif in WebView is very strange!!, how to fix this?

I have an application with a WebView, where there's a long list of posts that Autoloads via Ajax when the user approaches the bottom of the scrollable area, so I display the word "Loading ... " and an animated GIF beside it created via Ajax Loader site.
The problem is that this Gif sometimes appear as a still image in some devices with Androind 2.3.5/2.3.6, and in other devices its animation is extremely fast, and in other devices it's extremely slow.
E.g. Galaxy S Mini with OS: 2.3.6 (it appears as a still image).
Galaxy S I9003 with OS: 2.3.6 (it plays in a very very fast rate).
Galaxy S2 with OS: 4.0.3 (It plays very fast then suddenly becomes extremely slow but it's still animating).
Is there a standard frame rate or any work-around for this issue ?,
Here's the image That I'm using:
------> <--------
I know Facebook's app was using WebView with loader at the bottom of the feed but I don't know if it was animated gif or not.
I know that older versions of Android didn't support animated GIFs but I'm talking about new version
I had exactly the same problem and found no solutions! Animated GIF behavior seems really inconsistent across devices. That's the bad news. The good news is that I've made a work around, specifically for ajax loaders like yours.
You'll need to make separate image files for each frame of your GIF. It sounds horrible but it worked out ok for me - My 8 frame 8kb GIF turned into 8 png images totaling 11kb, and I got the bonus of 8bit transparency so I don't have to worry about the background color. It does mean the client has to make extra requests for the separate images though, so the fewer frames the better. I called the images 0.png, 1.png ... 7.png and put them in a folder to keep them neat.
Now the code! I'll explain it below.
HTML:
<img src="images/loader/0.png" id="headLoader" />
<div id="loaderKicker" style="visibility:hidden;"></div>
JavaScript (jQuery):
var loaderImg = $("#headLoader");
var loaderProg = 0;
setInterval(function() {
$("#loaderKicker").html(loaderProg);
loaderImg.attr("src", "images/loader/"+loaderProg+".png");
loaderProg = (loaderProg+1)%8;
}, 300);
First we have the img that we will animate. We use setInterval to change the image url to cycle through the frames. Really short intervals obviously put load on the device so we don't want to go nuts. I have a really cheap Android 2.2 device and 200ms+ intervals seem to work ok without wrecking app performance.
The loaderKicker div is there to make this work on older devices (like the ones we're targeting :) ). Android seems to ignore the calls when all we do is update an image url, so we get around this by updating the contents of a hidden div. I tried always updating with an "x" but it seems that the content has to actually be different. The slide number works well.
So that's it! It's a bit of a hack job but it works on everything I've tested on (Android 2.2, 2.3, 4.0, iOS6, Firefox, IE, Chrome) and if you're only doing it on one ajax loader that you'll then use everywhere it seems ok.
The other, completely separate, solution is to animate the image using HTML5 canvases but I couldn't tell you anything about support for them in old devices.

How to make Android WebView display partially loaded images?

When I display an image in an Android WebView, any image which isn't completely downloaded (including any truncated local file) won't appear at all. Most browsers will display as much of the image as they can, so the image appears gradually instead of just suddenly appearing after several seconds of nothing. How do I get WebView to do this?

Android DIV image changed, when clicked on the page

If you open any popup image in the Android browser, then click in any place on the page, the image is being changed (colors/sharpness/whatever - I can't define precisely, since I'm not an artist).
To see this effect, open a site with a popup image, which is implemented as a div with absolute positioning (say, http://highslide.com/ -- the first site I've googled). The site should be open in the Android browser (I've tried Android emulator from Eclipse ADT plugin and Kindle Fire). Click on any preview to popup the image, then tap on the page (keep you finger on the screen) and look at the image the same time.
My question: what this effect is about and how to eliminate it? Why don't I see it neither on PC nor on Mobile Safari? I have the same effect with my web-app, where it looks ugly and seems to be slowing a form, so I want to get rid of it.
A figure:
I've enlarged a portions of two shots, made before tapping on the arrow point, and after, and inserted them on top to show what I'm talking about.
Regards,
There's nothing wrong with your web app or your web page, this is simply a performance feature of Android. You can see this on the homescreen when you scroll and it happens in any application that scrolls.
When you tap, it signals to Android that you might potentially start scrolling. To prepare for this, it uses a compressed version of the images to make scrolling smoother.
You don't see this on your PC because your PC has no problem scrolling through a web page with tons of images at full resolution. As to why you don't see it on mobile safari, I don't know enough about the platform to say.
If every image on the page has the same physical size as specified in HTML/CSS, this effect disappears. That's why I observed this in popups: their inner images usually are resized.
I have mixed feelings. Kinda satisfaction for finding it after all and hatred to Android developers for programming this feature.

How to render a full resolution image with WebView in Android?

The problem:
I want to use a WebView to enable dynamic loading of ads in my app. I'm currently running on a HDPI device, and images width a width of 480px are clipped/scrolled. If I use images with a size of 320px, they are zoomed in and rendered at too low a resolution.
The content of the loaded WebView url is a simple web page with just an image tag wrapped in a link, as well a simple head. I've tried playing with the viewport meta-tag, but without any luck.
Any suggestions?
Ok, I seem to have worked it out. It's all explained here: http://developer.android.com/reference/android/webkit/WebView.html, under the heading Building web pages to support different screen densities. Not sure if this section was there when I asked the question, but since my question has had a few views and no solution, I thought I'd post it here.
I had the same issue with a subway map image (1000px, also tried 3000 px width before) in a webview: when zooming, the image gets totally blurry, even though the original graphic is very sharp and uncompressed.
The only way I found is to split the images into multiple slices and put them back together via html table. This way, the sharpness remains when zooming.
Not sure, which device you're on, but there are i.e. some display issues in general with the Nexus One for example: http://www.displaymate.com/Nexus_One_ShootOut.htm

Categories

Resources