Posts

Showing posts from February, 2014

How to check cookie enabled in browser using javascript

Its quite simple to find the status of the cookies enabled in browser. We can get the status of cookies enabled using below statment: window.navigator.cookieEnabled Use Facebook to Comment on this Post How to check cookie enabled in browser using javascript

Detect Mobile device through javascript

Detect Mobile device through javascript A pretty simple solution is to check for mobile device is the screen width. Almost all mobile devices have a max screen width of 480px. We can get the screen width using below statement: var screen_width = window.screen.availWidth; The only exceptions are tablet pc's like the ipad. These devices have a higher screen width than smartphones. We can use browsers user agent to determine whether this is a mobile device or not. Below is the function to determine the mobile device based on user-agent: (function(a){         if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av