tiagoporto/accessibility-buttons

IE Edge Issue: SCRIPT16389: SCRIPT16389: Unspecified error.

aparna-github157 opened this issue · 4 comments

I am getting an error in IE Edge that "SCRIPT16389: SCRIPT16389: Unspecified error." It's working on all the browsers except Microsoft Edge.

This is my code:

App.controller('home', function(page){

	   if(typeof localStorage !== "undefined"){
		   if (localStorage.getItem("reciepent-list") !== null) {
              
              //var reciepentList = JSON.parse(localStorage.getItem("reciepent-list"));
			   var reciepentList = localStorage.getItem('reciepent-list') ?
				   JSON.parse(localStorage.getItem('reciepent-list')) : 
          [];
              
              $.each(reciepentList, function( index, value ) {
                
                  $(page).find("#contactList").append('<div class="app-button redirect">' + value + '</div>');
            
              });
              
              $(page).find("#contact-list").show();
              
              $(page).find(".redirect")
                  .clickable()
                  .on("click", function() {
                  
                  localStorage.setItem("to", $(this).html());
                  
                  App.load('sendEmail');
                  
                  
                  
              });
              
              
          } else {
              
              $(page).find("#contact-list").hide();
              
          }
          
	   }
	   
	 
   });
	
   App.controller('sendEmail', function(page){
	   //alert("sendEmail loaded");
	   
	   if(typeof localStorage !== "undefined"){
		   
		  if(localStorage.getItem('from') !== null){
			  $(page).find('#from').val(localStorage.getItem('from'));
		  }
		   
	   }
	   
	   
	   
	   $(page).find('#send').
	   clickable().on('click',function(){
		   
		   if(typeof localStorage !== "undefined"){
			   localStorage.setItem('from',$('#from').val());
			   
			   var reciepentList = new Array();
			   
			   if(localStorage.getItem('reciepent-list') !== null){
			   
			   reciepentList = JSON.parse(localStorage.getItem('reciepent-list'));
			   }
			   
			   if($.inArray($('#to').val(),reciepentList) == -1){
				   reciepentList.push($('#to').val());
				   reciepentList.sort();
				   localStorage.setItem('reciepent-list',JSON.stringify(reciepentList));
				   //alert("in array");
				   console.log(reciepentList);
			   }
			   
		   }
		   else{
			   alert("Email data couldn't be saved");
		   }
		   
	   })
	   
	 
   });
  
   
	
   try{
	   App.restore();
   }
	catch(err){
		App.load('home');
	}

I am getting error in these two lines of code:

   if(typeof localStorage !== "undefined"){
		   if (localStorage.getItem("reciepent-list") !== null) {

How to solve this issue. Any help would be highly appreciated.

Hello @aparna-github157 , I have only Edge chrome version to test, and the lib is working. Also, the reported error is not related with the lib.

One suggestion, try to change you first if to

- if(typeof localStorage !== "undefined"){
+ if(localStorage){
  if (localStorage.getItem("reciepent-list") !== null) {

Thanks for the reply. Actually, this issue is only with IE, IE Edge/ IE11. It's working fine in all other browsers.

I have added if(localStorage){ but after adding this, I am getting error in my local system that:
0: Unspecified error.
Getting the error in this line: App.controller('home', function(page){

Even I tried uploading it on Eco web hosting server. After that I am not getting any error in IE Edge / Microsoft Edge. But still, it's not showing the page. But now it's working properly in IE 11.
Here is the link to the page:
http://apsecoglobalwarming-com.stackstaging.com/EmailClientApp/indexx.html

Is there any other way to make it work in IE Edge/Microsoft Edge.

@aparna-github157 The issue could be caused by IE missing support for some es feature you are using. Debug the error and polyfill, check core-js to polyfill you need.