I have added an onClick event handler for an element in my page. In the event handler, I run getFileUrl to get a download url.
However, my question is that I am not sure how to use the returned download url. I know if you copy&paste the download url in browser, the file will automatically be downloaded for you. But I want to automate the “copy&paste download url in browser” step in code. How can I do it?
Currently, I have 2 ideas.
First, run wixLocation.to(fileUrl)
Second, run $w(#elementId).link = fileUrl
which one of them works properly? what’s the differences between them? are there other solutions better than those 2?