Click to export

I want to be able to have an JS run export function that exports page data when an export/download link is clicked. However, despite multiple efforts I can’t get this to work as it just opens a blank page in a new tab. Is this a pickaxe studio driven behaviour?

Thanks.