BlackBerry Browser Bug
One of the more hilarious moments in developing the Mobile Browser Concurrency Test came due to an obscure and undocumented bug in the BlackBerry browser.
As we neared release of the test, we found that a certain set of BlackBerry devices was exhibiting odd behavior. While the user would never see the four rows of images in our test, both the test and that apache logs would report that the images had been downloaded.
After several hours of trying to figure out how our code had gone astray, we were getting desperate. So John drove to a local AT&T store. He found a BlackBerry to test with and called the office so we could change the code while he tested in the store. That phone call was one for the ages.
We stripped every line of code out of our test page until we had simply the html, head, body, and img tag. And the image still wasn’t rendering.
Finally, we removed the height and width attributes from the image tag and it finally worked. But this made no sense because we had an image tag on the other pages that had the height and width set and was displaying properly.
Further testing revealed that a bug in the BlackBerry browser: it will not display images if the height and width are declared and either is 4 pixels or less. Our test images were 4 x 4 squares.
Yes, it is that specific. Less than five pixels and the browser will download the file, but the image will never render on the page. In fact, the rules for when the image will and when it won’t display are even more specific:
- If the image width and height are set to 5 pixels or greater, the image will render.
- If either the height or the width is not declared in the attributes, the image will render.
- If both the height and the width are declared in the attributes and either is 4 pixels or less, the image will not render.
- The original size of the image does not matter. The only thing that matter is the size of the image declared in the html attributes.
If you have a BlackBerry, we’ve provided a test page to demonstrate the bug.
We don’t know how often people are going to build web pages for BlackBerries with images less than 5 pixels on one side, but we do know that if you do, you better be careful how you code the page or no one will ever see your work. We’re also certain that if BlackBerry wants to compete on the mobile web, it is going have to improve its browser.