HTML drag/drop - how to set the filename of an *outgoing* drag (to desktop)

前端 未结 4 1057
予麋鹿
予麋鹿 2021-02-19 07:11

I\'m trying to make it so a user can drag an icon from the web browser to their desktop, and a text file is created. I\'ve got the content part down, but I can\'t figure out how

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-19 08:03

    You can write

    event.dataTransfer.setData = ('text', 'tmp.txt');
    

提交回复
热议问题