javascript - encodeURIComponent error in IE11 -


the error i'm getting not helpful:

script445: object doesn't support action

and code throwing is

  $('#my-button').click(function(e){     e.preventdefault();     var link = document.createelement('a');     link.href = 'http://www.example.com/'+encodeuricomponent(data.name);     link.target = '_blank';     if(document.createevent){       // ie 11       eventmouse = document.createevent("mouseevent");       eventmouse.initmouseevent("click",true,true,window,0,0,0,0,0,false,false,false,false,0,null);     } else {       eventmouse = new mouseevent('click');     }     link.dispatchevent(eventmouse);   }); 

where data.name i'm getting ajax return create button's click handler function , location string "nashville, tn". code works fine on chrome & firefox breaks in ie 11. if remove +encodeuricomponent(data.name) works fine in ie 11 well, that's sort of important part. microsoft's encodeuricomponent documentation leads me believe function shouldn't causing issues in ie 11 either.


Comments