0
Answer

handling dom element cross site scripting in angularjs

Rj dk

Rj dk

4y
738
1
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();