How to access .document in wix advanced editor?

const a = document.createElement('a');
a.style.display = 'none';
a.href = 'https://exemple.com/myaudio.mp3';
a.download = 'myaudio.mp3';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);

Im gettint this error:

“Cannot find name ''document”. Do you need to change your target library? Try changing the ‘lib’ compiler option to include “dom”

So… is possible to access the tsconfig.json? how to access the .document in wix advanced editor?

Since Wix provides a component-based editor that relies on a virtual domdocument cannot be directly accessed, nor can tsconfig.json.

For this particular task there are these options:

Hi @anthony thank you for your answer.

Is possible to upload a mp3 file from front end using the url for this file to the Media Manager and then download this same file? I’m trying to get a mp3 file from an api and then make available to the user to play and download on the front end.

Yes you can do the downloads as mentioned above. For playing the file you can use the AudioPlayer and set its src value.