a developer's notes – a semi-technical web development BLOG

February 12, 2014

Check if Browser is IE and Which Version of IE with HTML

Filed under: CSS / Styling,HTML — Duy Nguyen @ 8:16 pm
Tags: , , , , ,

Check if the browser is using IE8

<!--[if IE 8]> 
	<script src="_ie8.js"></script>

This stylesheet will only display to IE9 or above, along with every other non-IE browser. Notice opening and closing expressions are wrapped in comments.

<!--[if gt IE 8]><!-->
	<script src="_nonIe8.js"></script>

**Make sure the src path reference begins with a slash (/scripts/myscript) and not use the root tilde reference. This (~) doesn’t seem to work within the conditional hthml.

Reference: http://www.impressivewebs.com/conditional-comments/
Reference: http://reference.sitepoint.com/css/conditionalcomments

HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries. This is for Bootstrap 3 support.

<!--[if lt IE 9]>
	<script src="~/../Scripts/html5shiv-3.7.0.js"></script>
	<script src="~/../Scripts/respond.min-1.4.2.js"></script>
	<link href="~/../Content/bootstrap-glyphicons.css" rel="stylesheet" />

September 5, 2011

Can’t edit file that is locked on Server 2008 with Notepad++

Filed under: General Tips — Duy Nguyen @ 2:20 pm
Tags: , , , , , , ,

When trying to edit a file on Windows Server 2008 with Notepad++, you might get this error:

“Please check whether if this file is opened in another program”

Run Notepad++ as an administrator by right-clicking on the shortcut, and choose, Run As Administrator.


Check for null or undefined in Javascript

Filed under: Javascript / JQuery — Duy Nguyen @ 12:34 pm
Tags: , , , ,

Here is how you can check if a variable is null or undefined.

function MyMethod() {
     var myVar = document.getElementById('something');
     if(typeof(myVar) !== 'undefined' && myVar!= null) {
          return myVar.checked;

OR this…

if( value ) {

will evaluate to true if value is not:

empty string (“”)

Create a free website or blog at WordPress.com.