HTML
Articles related to HTML Development
PHP Validating HTML Class using regular expression
Sep 7th
Validating HTML Class on the fly to pass W3C validation to get valid html.
W3C format for HTML Classes: abc or a12 or a_1 [first character is always required to be letter, no commas, semi-colons are allowed]
if (preg_match("/(^[a-z]{1}([a-z0-9_-\s])+)$/", $html_class)) {
$tag->setAttribute("class", $html_class);
}
PHP Validate HTML ID using regular expression
Sep 6th
Validating HTML ID on the fly to pass W3C validation to get valid html.
W3C format for HTML IDs: abc or a12 or a_1 [first character is always required to be letter, no spaces, commas, semi-colons are allowed]
if (preg_match("/(^[a-z]{1}[a-z0-9_]+)$/", $html_id)) {
$tag->setAttribute("id", $html_id);
}
HTML remove cookies from static files, images etc
Mar 24th
If you have not configured your application and server, it might send them to browser with cookie information.
that’s costing you as extra traffic and slow load times.
<FilesMatch "\.(css|js|jpg|jpeg|png|gif)$">
<IfModule mod_headers.c>
Header set cookie ""
</IfModule>
</FilesMatch>
HTML Reduce time on page load using performance images
Mar 24th
used this method while ago when i was working for one of those websites in top 10 the purpose was to reduce the loading time of the page and improve the parallel download
$(document).ready(function() {
/* apply performance image */
$.each($('img'), function(k, v) {
var src = $(v).attr('src');
if (src.indexOf('#') >= 0) {
src = src.split('#');
$(v).attr('src', src[1]);
}
});
});
the trick is simple. host a 1×1.gif image or don’t. up to you and separate the actual image path with ‘#’ and when the dom is ready start replacing them with original path.
make sure your images cachable.
HTTP Status Codes
Jan 26th
HTTP Status Codes ———————————————————————————— 200 : request completed (OK) 201 : object created, reason = new URI 202 : async completion (TBS) 203 : partial completion 204 : no info to return 205 : request completed, but clear form (more…)


LinkedIn
Twitter
Skype