Getting "prompt aborted by user" javascript exception
        Posted  
        
            by 
                Bhagwat
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bhagwat
        
        
        
        Published on 2011-11-21T11:39:57Z
        Indexed on 
            2012/11/09
            11:02 UTC
        
        
        Read the original article
        Hit count: 289
        
JavaScript
I am getting "Components.Exception("prompt aborted by user", Cr.NS_ERROR_NOT_AVAILABLE)" exception when I am using "windows.location.href" in javasacript. My Code is:
function checkCookie(){
var value = null;   
var cookieName='UserDetailsCookie'; 
value=ReadCookie(cookieName);   
if(value != null){          
    var url='<%=request.getContextPath()%>/jsp/admin.jsp';
    window.location.href = url;     
}
document.loginForm.userName.focus();
}
function ReadCookie(name)
{
  name += '=';
  var parts = document.cookie.split(/;\s*/);
  for (var i = 0; i < parts.length; i++)
  {
    var part = parts[i];
    if (part.indexOf(name) == 0)
          return part.substring(name.length);
      }
  return null;
}
and I am calling this method on onLoad event of body
<body onLoad="javascript:checkCookie();">
In anyone knows why this exception throws please?
© Stack Overflow or respective owner