HTML5 History API - dynamic websites like never before - Web Species blog I have talked about this before, but JavaScript should not dictate content or website structure. It should only improve the UI, but even with JavaScript disabled website should work. Using the new HTML5 History API allows to do that one step further - making dynamic websites behave like normal ones. What is History API? History API is quite a simple concept - a JavaScript API you can use to control history state. With using History API you can add an entry to history stack once some dynamic content is loaded. All this behavior is very well explained in “Dive into HTML5” book, but in short when you load some content using Ajax or you move user to a place in a page which you want to have linkable - use History API. Of course like with most of the new HTML5 functionality, this is not supported in all browsers. How to use it? There is only one main method: history.pushState(state, title, link); and one event: State example from Mozzila documentation: How I used it Conclusion
PHP5 WebSocket Example – A Simple Chat | BOHUCO The classic example for websockets is a chat. This chat example has only 200 lines of code (excl. the Websocket class), is really easy to understand and customizable. The WebSocket class takes a function (or class method) as callback for every socket action, for this example i use the process method of the WebsocketChat Class: The WebsocketChat Class handles user actions and messages. We have two actions: ‘login’ and ‘chat’. On the client-side we have to send the right actions if someone clicks ‘login’ or ‘send message’. The login action adds a new chat user to the user-array and loads the last five messages for this new user. If the ‘chat’ action is called then add a new WebsocketChatMessage to the message array and send it to all current chat-users: The WebsocketChatMessage is just a container-class for holding the message data: View Chat Example on BOHUCO Labs View server.php Code
URL rewriting pour les nuls Hello, C'est sans doute moi mais je n'ai pas trouvé de tutoriel pour les Rewrite Rules sur le site. Je vous propose donc le mien. Principe:L'url rewriting permet d'utiliser des urls toute simples au lieu d'url longues et complexes maPage-val1-val2-val3.html à la place de maPage.php? Vous devez vous meme modifier l'ecriture des URL DANS VOTRE CODE SOURCE. Avantages:Les bots suivront les liens simplifiés et indexeront votre site en profondeur. Inconvénients:Il faut un serveur à la hauteur - car cela consomme en ressource. Comment ca marche? RewriteEngine on RewriteRule \photo-([0-9]+)\.html$ /photo.php? Et réecrire vos liens dans vos pages. L'url rewriting décortiqué:D'abord il faut identifier les liens que vous allez réecrire: Comme je suis photographe j'ai un site qui gére des photos, des albums (appelés event) et des portfolios. portfolio.php? Dès que vous avez listé les URL vous devez concevoir le format des nlles URLs. Ajouter les regles de réecriture dans le .htaccess / debute la réécriture ex
What To Do When Your Website Goes Down - Smashing Magazine Advertisement Have you ever heard a colleague answer the phone like this: “Good afterno… Yes… What? Completely? An important website has gone down, and sooner or later, heads will turn to the Web development corner of the office, where you are sitting quietly, minding your own business, regretting that you ever mentioned “Linux” on your CV. 1. Don’t take your client’s word for it. If it fails, then visit a robust website, such as google.com or bbc.co.uk. If the website is definitely down, then frown confusedly and keep reading. 2. A website can appear to have gone down mainly for one of the following reasons: A programming error on the website,A DNS problem, or an expired domain,A networking problem,Something on the server has crashed,The whole server has crashed. To see whether it’s a programming error, visit the website and check the status bar at the bottom of your browser. Otherwise, you’ll need to run some commands to determine the cause. C:> ping www.stockashop.co.uk 3. On Windows: 4.
Récupérer un podcast pour l'écouter en ligne 8 fév. 2011 En utilisant PHP et JavaScript, nous pouvons récupérer à la volée dans un podcast les données nécessaires pour le mettre en écoute dans un module comme dewplayer (lecteur gratuit de mp3). Pour réaliser notre lecteur de podcast dynamique, il nous faut d'abord rendre le XML lisible, nous prenons en effet un flux extérieur au site dans lequel nous voulons afficher notre dewplayer. Pour que cela fonctionne, il est indispensable que le serveur pense que ce fichier XML se trouve sur notre site. Il existe une parade en PHP pour le faire. Vous devez créer un fichier, par exemple podcast.php, et y mettre le code suivant : Pour cet exemple nous avons choisi un podcast de radiofrance. Maintenant si vous ouvrez en ligne votre fichier podcast.php il s'affichera avec le contenu XML du fichier extérieur hébergé sur radiofrance. Pour la suite nous allons passer par jQuery. 1. avec l'extension jquery.jfeed.pack.js. 2. Code complet d'une page avec un podcast :
Quick Feedback Form w/ PHP and jQuery Martin Angelov When releasing a web product, there is nothing more beneficial than receiving early feedback from your users. Unfortunately, many websites make it unnecessarily difficult to send your feedback or lack this functionality altogether Today we are making a simple solution to this problem. Powered by jQuery, PHP and the PHPMailer class, this form sends the users’ suggestions directly to your mailbox. The HTML Lets start with the HTML markup. feedback.html <! Inside the body you can see the #feedback div. Inside it reside the five color spans. Lastly is the .section container, which holds the heading, the textarea and the button. Quick Feedback Form w/ PHP & jQuery The CSS Moving on to the styling of the form, we first have to say a couple of words about how the stylesheet is structured. styles.css – Part 1 The first element to be styled is the #feedback div. At the bottom are the CSS rules which define the looks of the textarea. styles.css – Part 2 Sending an AJAX Request The jQuery
The Collection DD_belatedPNG: Medicine for your IE6/PNG headache! 2011/4/8: This is no longer an actively maintained project. I apologize, I must move on with current events. This is a Javascript library that sandwiches PNG image support into IE6 without much fuss. You can use PNGs as the SRC of an <IMG/> element or as a background-image property in CSS. If you attempt the latter, you will find that, unlike with vanilla usage of AlphaImageLoader, background-position and background-repeat work as intended. As a bonus, "fixed" elements will respond to a commonly used set of Javascript style assignments, as well as the A:hover pseudo-class. Table of Contents Long story short, this uses Microsoft's implementation of VML instead of Microsoft's AlphaImageLoader filter. The intended implementation is pretty easy: Download a copy of the DD_belatedPNG Javascript file - please do not hotlink mine, I am on a shared host. Due to popular demand, here is some documentation for how to "fix" elements on a pick-and-choose basis. (Based on the normal usage approach)
Htaccess : cache control et expire headers Le htaccess est un fichier de configuration de votre serveur, et celui-ci peut vous rendre énormément service pour les performances de votre site, sur l’expérience utilisateur et sur le référencement naturel. Mais c’est un peu le flou sur la manière de le configurer. Si vous rencontrez des soucis avec ce code et que vous souhaitez que nos équipes se charge de l’adapter et de l’installer, faites appel à nos services de développement. Voici donc un guide pour coder votre fichier htaccess : Avant propos Testez, testez et testez ! Chaque code donné ici permet d’optimiser le fichier htaccess pour accélérer votre site, le sécuriser et réduire la bande passante utilisée. Mais en fonction de la configuration de votre serveur, les codes peuvent ne pas fonctionner : vous devez absolument tester et adapter chaque code en fonction de vos besoins ! Quelques définitions Pour mieux comprendre cet article, voici quelques explications. Htaccess : c’est un fichier de configuration pour un serveur web apache.
Anti-Spam - Prémunissez-vous contre les « spammeurs » | bulk unsolicited unwanted junk email 50 Online Tools to Convert Documents and Media Files | Technically Digital Downloading a document only to find that you do not have the application to open it can be frustrating. Thankfully however there are numerous web apps that help you out of this predicament. We have gathered 50 such online tools that help you convert not only digital documents but also images and various other media files. Read on to find the tools and see which ones suit your needs best. Audio/Video Converters KeepVid : KeepVid is an useful online utility which helps users download videos from different online streaming websites. CellSea : CellSea is another useful converter which can help users download, convert, crop and resize videos from different streaming websites. VideoDownloadX : With VideoDownloadX, users can convert and download videos from YouTube. GetYourVideo : With GetYourVideo, users can download videos from different online video streaming websites including DailyMotion, YouTube, Metacafe and many more. Document Converters Image Converters Multi-Purpose Converters
Un tutoriel de la mise en cache pour les auteurs Web et les webmestres pour les auteurs Web et les webmestres Ce document est informatif. Bien que de nature technique, il essaye de rendre les concepts mis en jeu compréhensibles et applicables à des situations concrètes. Pour cette raison, certains aspects de la documentation sont simplifiés ou omis, par souci de clarté. Si votre intérêt sur le sujet vous porte aux détails, veuillez explorer le chapitre « Références et autres informations » à la fin. Qu’est-ce qu’un cache Web ? Un cache Web se tient entre un ou plusieurs serveurs Web (appelés aussi serveurs originaux) et un ou plusieurs clients, et il observe le va-et-vient des requêtes en enregistrant pour lui-même des copies des réponses — comme des pages HTML, des images et des fichiers (appelés collectivement des représentations). On utilise des caches Web pour deux raisons principales : Les types de cache Web Les caches de navigateurs Les caches de serveurs mandataires Les caches de passerelles Les caches Web ne sont-ils pas mauvais pour moi ? Par exemple :
Creating responsive images using the noscript tag | Head When building responsive websites, you immediately run into the problem of trying to implement responsive images which would be sized correctly depending on the user's device. Either you want to hide images from mobile users or give them an optimised version. The problem centers on the page loading anything referenced in the HTML even if it’s hidden by CSS in your media queries. This can lead to your mobile users getting a big hit from content they aren’t even using. This problem can’t be handled entirely on the server side. You have to make contact with the user’s device before you can determine how much screen width is available. We came across a couple of existing libraries. Using the Webkit developer tools, HTTPWatch for Internet explorer and HTTPfox for Firefox we were surprised to discover that removing the element with JavaScript prevented the request being made to the server. We created a Rails helper gem, responsive_image_tag, to insert the necessary markup into the page: