There is very strange. It looks like after the If statement, the script it stop. The page has a javascript function is called by clicking the button. If the browser on IE, I will do something. Otherwise I close the page. I put alert statement to test it. However the alert has never fired. Would someone tell me what's wrong will my code.
There is my button call the function:
<input class="btn" id="btnClose" onclick="javascript:openFile();" type="button" value="Close" name="btnClose" />
There is the javascript function:
function openFile() {
var url = 'file://' + document.getElementById("hdURL").value;
//alert('Open File' + url);
var location = document.getElementById("hdURL").value;
////http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
if ((/*@cc_on!@*/false || !!document.documentMode) ||(!isIE && !!window.StyleMedia))
{
alert('IE');
//do something
window.self.close();
}
alert('test'); //never fire
closeWindow();
}