Example of using the showModelDialog pop up file download window

  • 2020-03-29 23:51:26
  • OfStack

When I click to modify, I need to generate excel files in the background, and I need to provide the function of downloading files.
Easy to generate excel files, easy to pop up "file download" :
Click the button, jump to the action, generate the Excel file in the action, fill the data, save to the temporary folder, and then in the Click event of the button, generate the Excel report according to the template, fill the data, save to the temporary folder, and then output.wirte(). Everything seems to be going well.
The Action is as follows (the "file download" window pops up) :

//To pop up the save window, set as attachment
//Read the stream and write to the file

But when I tested it, I found that when I clicked the "I want to modify" button, a new window always popped up. Baidu, add this paragraph: < Basetarget = "love" > , which means the page opens on the current page.
As follows:
Base: specifies the default address or default destination for all links on the page
Target: to the target page
< Basetarget = _blank > < ! -- open on a blank page -->
< Basetarget = _parent > < ! -- opens on the previous page of the current page (parent class) -->
< Basetarget = _search > < ! -- open in the browser address bar -->
< Basetarget = love > < ! -- opens on the current page -->
< Basetarget = _top > < ! -- opens on the original page -->
This problem was solved, but a new one came up, which was that the files could not be downloaded. So do I have a way to both open it on this page and make it available for download? I think of an iframe. We can set an invisible iframe frame, and then target=iframName will solve it.

<iframe id="download" name="download" height="0px" width="0px"></iframe>
<base target="download">

This < The base... > Located in < Head> < / head> between

Related articles: