Saving a document when opened with window.open in chrome

I have a problem opening a new window with javascript. I have HTML code in var called "theCode";

var j = window.open('') j.document.write(theCode); j.document.close(); 

The following code works fine, but in chrome I canโ€™t save a new document or view the source code (options are disabled). In firefox, this is great. Is there any way around chrome for this?

+6
source share
1 answer

A few months after the fact, but I'm sure you can use the data URI for this:

window.open ("data: text / HTML; base64," + btoa (theCode))

+1
source

Source: https://habr.com/ru/post/947040/


All Articles