Sunday, February 2, 2014

My iPad Crashes When I Display Flickr Photos on My Blog

Well, not the iPad, actually.  Just the Safari web browser.

I store my photos on Flickr.  I have a travel blog on Blogger.  Embedding photos from Flickr on the blog is not particularly easy but I have been doing it for several years.  The Safari web browser on our iPad now crashes any time we try to load my TravelBlog.  It is reproducible.  And, I can load every individual post currently visible on the blog - it only crashes when I try to load the entire current blog!  What changed? 

Flickr used to generate some HTML code to use in accessing pictures from elsewhere on the Web.  I simply copied that code and pasted it into my blog posts.  It looked like this:

<a href="" title="Albany-24 by T J Sawyer, on Flickr"><img alt="Albany-24" src="" height="214" width="320" /></a>

Back about November of 2013, Flickr "improved" their linking mechanism and began producing this type of embed code, instead:

<iframe allowfullscreen="" frameborder="0" height="271" mozallowfullscreen="" msallowfullscreen="" oallowfullscreen="" src="" webkitallowfullscreen="" width="500"></iframe>

What Flickr did was to change their default from embedding just the picture to embedding the full Flickr page in what is called an iframe. (iframe is a WWW concept, not an Apple concept)  Now I was not particularly happy with this change on the part of Flickr, but I could live with it.  It meant that viewers of my blog could get distracted (bored?) and just start to scroll through all the pictures on the referenced Flickr set.  I could probably control that by putting each blog photo in its own Flickr Set, but I didn't want to go to that much trouble.  I already group the photos into a set for each post and don't really mind if a reader decides to explore that whole set.  I checked a few other blogs and noticed that other bloggers, such as the widely read Ann Althouse, have continued to use the Flickr link on her blog.  I don't believe she even complained when the change was made.

So, I began using the new embedded iframe code back in December.  After about two weeks in Egypt, the Travel Blog would no longer load on our iPad.  I suspected a memory problem and began the usual remedies.
  • I closed the other tabs in the Safari browser.
  • I killed all the other apps that were running (Not a trivial task under iOS!)
  • I restarted the iPad
  • I even upgraded the operating system to iOS 7.04 - a new look and feel that deserves its own rant, but I'll do that later.
All to no avail.  I searched the Internet for solutions and found a lot of people having trouble with the new Flickr and an amazing number having iPad Safari problems.  So: let's isolate the problem further.

Consider those two pieces of code that I have above.  Let's just embed them in this post:

If I display this post or this blog.  All is well.  However, what happens if I repeat that last embedded picture?  I tried repeating it 25 times.  The blog loads fine.  If, however, I repeat it 50 times, the blog will no longer load on the iPad.  Instead, it crashes Safari!

I will leave it as an excercise for the interested reader/coder/computer science major to determine the exact number of imbedded iFrames that are required to kill Safari.

Now to my real rant!  Why hasn't this condition been analyzed and documented on the Web?  You can search for "multiple iframes crash safari" or a variety of variants and not find anything that resembles documentation of the real problem.

Worse yet, search for "Blogger Flickr iPad" and you will find nothing but nonsense.  For example, here.

There appear to be many people that think this is a Flickr problem.  It is not.  It is just a very sorry implementation of a browser by Apple.

What is a web browser?  It is nothing but a file listing program.  These have  been around since the days of the IBM 701 in 1953.  I suspect that a file lister was one of the first programs written for the SHARE library.  Sure, there are a lot more file types to be handled now than "in the old days" but give me a break.  When your file listing program has an issue with the number of items in a table or with some other constraint,  you don't just crash!  Put out an error message saying "Number of iframes on this page exceeds internal limit" and then render what you've got so far.

Good Grief, what are they teaching the young coders nowadays!