Enhance 404 Error Page, Make it Powerful

404 error

As a web developer, we’re so familiar with 404 error, and hate it so much. If¬† the URL doesn’t exist, the server will return this page to browser to show. Normally, we use default 404 error message to tell visitors they’re looking for pages that don’t exist. Some designers make 404 pages pretty or humorous. […]

Add Random String Verification to Prevent CSRF

web security

Cross-Site Request Forgery(CSRF) is difficult to trace, it could cause great harm. The attacker can use CSRF to prank, send spam information, delete data and so on. So how do we prevent CSRF? To deal with increasing CSRF attacks, Yahoo added a random string called crumb to the form. Facebook has similar solution, if you […]

CSS Hacks for IE6,IE7,IE8,IE9 and IE10

CSS hacks

Here are the newest CSS hacks for IE all versions, compatible with Firefox and Chrome. #hack{ color:red; /* All browsers */ color:red !important;/* All browsers but IE6 */ _color:red; /* Only works in IE6 */ *color:red; /* IE6, IE7 */ +color:red;/* Only works in IE7*/ *+color:red; /* Only works in IE7 */ color:red\9; /* IE6, […]

Get URL Parameters with JavaScript

http url

With the wide use of AJAX, sometimes we need get values of parameters from current URL, the below function is an very handy way to do so. function getQuery(name) { var reg = new RegExp(“(^|&)”+ name +”=([^&]*)(&|$)”); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; } Example: Get the id’s value from http://codemug.com/a.php?c=my&id=7&m=1 […]

How to send mails with PHPMailer


PHP mail() is an convenient solution of sending emails, it was easy to configure and didn’t take much time to get it work. Recently I found that Hotmail, Live.com couldn’t receive any mail using this built-in PHP function. It seems like some mail server require authentication before you send an email, and PHP mail() is […]

Custom scrollbars for IE, Chrome and Firefox using CSS

19 custom scrollbar themes

Using Custom scrollbars in your website can be really eye-catching and they go well with the website’s design. For web designers, it’s difficult creating them with JavaScript. Instead, you can create custom scrollbars using CSS. According to my acknowledge, it only worked in Internet Explorer. During my recent project, my client required the scrollbar to […]

JavaScript Strict Mode in IE 10

Strict Mode has been introduced from ECMAScript 5.0, the intent is to encourage developers choose an more standard version of JavaScript. For a long time, JavaScript has been¬†controversial for its loose and flexible syntax. Including Strict Mode in ECMAScript 5.0 makes it possible for Javascript’s interpreter to parse lines using Strict Mode syntax, which helps […]