From the BlogSubscribe Now

Inputs in Firefox storing previous values


Today’s problem came as a result of a Firefox anomaly. It’s one of those problems that comes up after launching because we were too lax in testing. Here’s how it broke down, without going into great detail about the application.

We’re building a CRM that stores asks and closes of our sales reps. The application shows recent asks and closes on the main screen, with the ability for the user to update said activities. The update option are in input fields, named the same, and updated via javascript behind the scenes.

When adding a new activity, the application inserts that entry into the table of current asks and closes. On reload, Firefox was showing old data in those fields, but if the user clicked on a different page and came back to the dashboard, they would see the correct data. Upon inspection, the value of the input was correct. Meaning the browser was replacing the input with what it believed to be good data.

Unfortunately this bug wasn’t caught until production. The answer was simple. We only needed to turn off autocomplete on each of the inputs. This immediately solved the problem.

autocomplete=off

Add that line to the input and the problem disappeared.

How to get a larger album cover image from iTunes API

I ran into this issue recently. I wanted a larger version than what’s returned from the basic response API search. The images there are intended for mobile applications and are available at 60 wide and 100 wide. Easy to get those. What are you going to do with it though? Take a look at the size of the largest version returned from the API.

But how do you get a larger version if your web application requires it? It doesn’t mention anything in the API documents.

Hence a bit of search and replace…take a look at this returned url from the basic api search.

http://is4.mzstatic.com/image/pf/us/r30/Music/ff/c9/01/mzi.jornkthw.100x100-75.jpg

Now all you need to do is replace where it says 100×100 with any value. Need an image that’s 400×400 wide? Change the values to equal that and you’re good to go.

A simple php string replace should do the trick. Here’s what I used to get a 200×200 version of the album.

$albumArt = $response->results[0]->artworkUrl100;
$albumArt = str_replace('100x100', '200x200', $albumArt);

I received the response from the iTunes search library made by Vinelab