Rj dk

Rj dk

  • NA
  • 5
  • 703

handling dom element cross site scripting in angularjs

Jun 4 2020 1:54 AM
I have to handle a XSS vulnerability in my AngularJs codes, where I'm trying to create a dynamic a tag with href link and then try to download the file. Below is the code reference. But, not sure how to check vulnerability and handle it for XSS in AngularJS by using no external library. Is it possible to do with sanitize.js files in angular? Any help will be appreciated.
  1. var file = new Blob([data],{type:false});  
  2. var fileURL = URL.createObjectURL(file);  
  3. var a = document.createElement('a');  
  4. a.href = fileURL;  
  5. a.target = '_blank';  
  6. a.download = "TestFile.pdf";  
  7. document.body.appendChild(a);  
  8. a.click();