Home > database >  Firefox: Error: Access to 'about:text/html' from script denied
Firefox: Error: Access to 'about:text/html' from script denied

Time:09-18

This code works with Chrome but not with Firefox:

var tab = window.open('about:text/html', '_blank')
tab.document.write(
  '<a download="mytext.txt" href="data:text/plain;charset=utf-8,'  
    encodeURIComponent(res.data)  
    '">Download</a><pre>'  
    res.data  
    '</pre>'
)
tab.document.close() // Do I need this? Why?

With Firefox, I'm getting this error message:

Error: Access to 'about:text/html' from script denied

How can I fix it?

CodePudding user response:

about:text/html is not an URL that actually exists, replace it with about:blank.

  • Related