background preloader

Best Practices for a Faster Web App with HTML5

Best Practices for a Faster Web App with HTML5
While good, this article only tells part of the performance story. View for the whole picture of performance improvements. Introduction Much of HTML5 aims to deliver native browser support for components and techniques that we have achieved through JavaScript libraries thus far. Using these features, when present, can end up delivering a much faster experience for your users. Tip 1: Use web storage in place of cookies While cookies have been used to track unique user data for years, they have serious disadvantages. These two web storage objects can be used to persist user data on the clientside for the length of the session or indefinitely. Tip 2: Use CSS Transitions instead of JavaScript animation CSS Transitions give you an attractive visual transition between two states. By adding the toggling the classes of totheleft and totheright you can move the box around. Tip 3: Use client-side databases instead of server roundtrips No guarantees, though. :) A guide to preventing SQL injection Non-Jquery Page Transitions lightweight | Free software downloads A New Front-End Methodology: BEM This article is the sixth in our new series that introduces the latest, useful and freely available tools and techniques, developed and released by active members of the Web design community. The first article covered PrefixFree1; the second introduced Foundation2, a responsive framework; the third presented Sisyphus.js3, a library for Gmail-like client-side drafts, the fourth shared with us a free plugin called GuideGuide4 and the fifth presented Erskine Design’s responsive grid generator Gridpak5. Today, we are happy to feature a toolkit devised by Yandex: BEM. BEM stands for “Block”, “Element”, “Modifier”. It is a front-end methodology: a new way of thinking when developing Web interfaces. Due to the length of this article, it was split into three parts: BEM Principles Link To begin, let’s first put BEM in some historical perspective. Some parts of the BEM stack started as open source projects, while others (like the UI component library) are being gradually open sourced. Block Example

Mobile Web Apps: Loading PagesBuildMobile This is the fourth excerpt from the book “Build Mobile Websites and Apps for Smart Devices” by Earle Castledine, Myles Eftos and Max Wheeler. BuildMobile is exclusively publishing a complete chapter from the book, the chapter on Mobile Web Apps, and this section is called “Loading Pages”. Now that we’ve learned the basics of handling touch screens, and picked up a couple of quick wins by optimizing our links and forms, it’s time to roll up our sleeves and get to work on the biggest component of just about any mobile web app. Unless your application is very basic, chances are you’re going to need more than a single page, and therefore, you need to think about how to switch between pages. Putting everything on one page, and then hiding and displaying sections as requiredLoading in new pages via AjaxIncluding only the complete skeleton of the app up front, and then bringing in data as required The approach you take will depend heavily on the application. 4.1. 4.2. Let’s start on the CSS.

WebPerf : "A quelle vitesse ma page se charge-t-elle ?" Cette question est à la base de toute stratégie de WebPerf et pour autant, elle n’admet aucune bonne réponse. Alors comment mesurer la performance Web ? Il n’y a pas de façon "standard" de mesurer la performance web mais plusieurs, qui correspondent à ce qui se passe dans le navigateur lors de l’accès à une page Web. Quand vous tapez dans votre barre d’adresse l’URL de Clever Age et attendez que la page s’affiche, votre navigateur : Se connecte au serveur hébergeant le site et lui demande de renvoyer le contenu de la page HTML Reçoit le contenu de la page HTML Interprète le code HTML pour comprendre comment est structurée la page et de quels objets supplémentaires (images, mises en forme, scripts...) elle a besoin pour être rendue Charge l’ensemble des ressources en question Affiche la page Exécute d’autres script après le chargement, impliquant eux-même le chargement de nouvelles ressources et le déclenchement d’animations Le "Time To First Byte" Quels problèmes ? Les temps d’affichage

Schepp/CSS-JS-Booster Epoch Converter - Unix Timestamp Converter Gérer ses dépendances JavaScript avec Google Closure Compiler / Library (1 / 2) JavaScript ne propose pas (encore) de moyen d’organiser son code et notamment de déclarer les dépendances entre les différents fichiers JavaScript de votre projet. Dans un langage compilé comme ActionScript ou Java, vous avez les directives « import pack.sub.MaClasse » qui vous permettent d’indiquer au compilateur qu’une classe requiert une autre classe pour fonctionner. Si vous avez quelques dizaines de lignes de code JavaScript dans votre projet, vous pouvez toutes les mettre dans un seul fichier ou directement dans le fichier HTML mais quand vous commencez à avoir plusieurs centaines / milliers de lignes de code, vous allez rapidement découper votre code en différent fichiers. Comme il n’y a encore rien dans le langage pour vous aider, plusieurs librairies / systèmes ont été créés, notamment: Pour en apprendre plus sur RequireJS, une des plus populaires, je vous conseille de lire ce très long et très bon article @mklabs : RequireJS ➤ mo-du-la-ri-té ! goog.provide(…) goog.require(…)

Quick Tip: An Introduction to jQuery Templating JavaScript Templating is a neat idea: it allows you to easily convert JSON to HTML without having to parse it. At Microsoft's MIX10 conference, they announced that they are starting to contribute to the jQuery team. One of their efforts is to provide a templating plugin. You'll need the data to template; you'll likely retrieve JSON from your server; of course, Object / Array literals work just as well, so that's what we use: The template is written in <script type="text/html"></script> tags; for each item in your JSON, the template will render the HTML; then, it will return the entire HTML fragment to you. To render the data with the template, call the plugin; pass the data to the plugin method; you can optionally pass in an options object as well. It's that easy!