Category Archives: Security

HTTP basic authentication in rails to protect staging server

Sometimes, you may need to protect your staging server from outside world. It can be done easily by using http basic authentication in rails3. I did following things to use HTTP basic authentication to protect my staging server: YML file with username and password pair: devuser: devpasstestuser: testuserpass Loaded YML data from application initializer: HTTP_AUTH_USERS…

Read More

Disable text selection on website by using javascript

Sometimes you may need to disable text selection of an HTML page. It is very easy way how you can do it. Below is the source codes: <script type=”text/javascript” language=”JavaScript”>function disableText(e){ return false;}function reEnable(){ return true;}//For browser IE4+document.onselectstart = new Function (“return false”);//For browser NS6if (window.sidebar){ document.onmousedown = disableText; document.onclick = reEnable;}</script> Just copy the…

Read More