Alternative for the ActiveX object for the other browsers excluding IE?

前端 未结 2 678
陌清茗
陌清茗 2021-01-19 17:02

Can anyone help me as i am stuck in creating a file(temporary) with extension(say .csv) in the local disk, i tried using ActiveX object but it works fine only in internet ex

2条回答
  •  清酒与你
    2021-01-19 17:22

    The other posts cover all the information about storing to the local machine using Html 5 so I won't go into any more detail about that but this is only going to work on Html 5 compatible browsers (although most browsers are Html 5 compatible now, I don't know your project requirements).

    Another alternative would be to create / save the file using server side code (ASP.NET, PHP etc) and then provide a link to the user so they can download the file. You can still save this as a .csv file so that the user can open it in Excel after they have downloaded it.

    Edit:

    What I would do is change your web service so that it saves the file to disc (more info: here). Then instead of returning the file from the web service, return the Url to download it instead. You can then redirect the user to that link using JS.

提交回复
热议问题