Mistakes? Everybody makes mistakes. It’s a human thing. If you don’t make mistakes,
it means that you are doing nothing. The real challenge for you, as a web developer, is to avoid them every time
you can.
Let’s say, that you have to develop app. Your main task is to provide support for all operating systems (Android,
iOS and Windows Phone). What mistakes you have to avoid? What challenges are waiting for you? How to cope with
them?
You are lucky. You really are. I will show you nine most common mistakes and their solutions. Some of them will be basic and another more advanced. Are you ready? Let’s get started.
1. Developing without research
Mistake:
You don’t know. whether it’s possible to include some particular feature in web app or not.
Result:
Many wasted hours, tons of frustration, unhappy client (or boss…).
Example:
Solution:
Identify your (or your customer’s) requirements and then check, if the targeted capabilities are achievable in a web app. Plan ahead. And succeed.
2. Using some HTML5/CSS3, which doesn’t work well on mobile or some devices
Mistake:
Assuming, that what works on desktop browser, will work on mobile as well, and using code, that doesn’t work on specific devices.
Example:
- Display:
flex
property causes problems on Android lower than 4.4 and iOS. The best thing you can do, is to find an alternative for flexboxes. - Position:
fixed
property causes problems on mobile Safari – elements are placed too far, beyond the screen. -
opacity
property doesn’t work on inline display states (default for a tags) on WebKit browsers.
Example not working:
Example working:
Solution:
- Always check, if you can use a specific part of code or not.
- Remember about
prefixes when using CSS (i.e. animation without
-webkit
won’t work). - Change the
display
state fromdisplay: inline
todisplay: block
ordisplay: inline-block
. - Use some great resources, like caniuse.com or html5test.com, to check what’s supported on specific devices.
You can also use media queries, for example:
3. Low resolution images on Apple’s Retina Display
Mistake:
Using only low resolution of images.
Result:
Images look fuzzy on Retina and pixelation may occur.
Example:
Solution:
- Server has to recognize, if request is coming from a Retina device, and if so – provide higher resolution images.
- You can also use SVG as images format and web fonts.
4. Site loads on mobile in more than 3 seconds
Mistake:
Expecting, that everyone always uses WiFi connection, which has enough speed (high speed).
Result:
Traffic drop, lower conversion, complaining users (and they’re right!).
Solution:
- Image optimization, Code compression, Database queries, CDN (Content delivery networks).
- You can also use AJAX to load some
part of the website first or you can also put scripts at the bottom before
</body>
html tag.
5. Mobile browser place focus on first input field on the website, even we don’t want that
Example:
Keyboard automatically shows up, if there is an input field on the screen.
Solution:
Placing hidden input above our input.
We can use this part of the html code:
6. Forgetting about prefixes
For example, if you want to use transition
property, you should
remember to use prefix -webkit-
before plain property.
Example working:
7. Setting height
to 100vh
Mobile Safari interprets document length differently, than other browsers and it adds unwanted bar, which is difficult to be fixed.
Example:
Solution:
8. Incorrect
usage of readonly
attribute
Let’s say, that you have used input type="text" readonly
and after clicking on it,
navigation bar shows up. If we don’t want to enter text into that input, we should add to this tag onfocus="blur()"
.
9. Creating web app only with only system (i.e. iOS) in mind
And now, last but not least, some thing you should do at the very beginning. Future users of your web app use different systems. Some of them have iPhone’s, some of them Android’s and some of them Windows Phone’s. You should plan your web app with them in mind. Otherwise, modifying web application, to work properly on all systems, can be time-consuming and very, very expensive.