Bind to the click event of btnRedirect using on
.
The cross browser redirect function used was taken from here:
$('#btnRedirect').on('click',function(){
_Redirect('mypage.aspx');
});
function _Redirect (url) {
var ua = navigator.userAgent.toLowerCase(),
verOffset = ua.indexOf('msie') !== -1,
version = parseInt(ua.substr(4, 2), 10);
// IE8 and lower
if (verOffset && version < 9) {
var link = document.createElement('a');
link.href = url;
document.body.appendChild(link);
link.click();
}
// All other browsers
else { window.location.href = url; }
}