如何获取以下代码的下载框。即,当用户单击下载超链接时,无论浏览器类型如何,都应出现下载窗口。我尝试了以下方法:
<a href="javascript:void(0);" onclick="download_tagged_file('{{cnt.id}}');">Download</a><
function download_tagged_file(cntid)
{
var snddata = {};
snddata["cntid"] = cntid;
$.post("/tagging/download_tagged_file/", snddata,
function callbackHandler(data, textstatus)
{
if (data.status == 1)
{
var url = data.filename;
url = "http://127.0.0.1:8000" + url
//var htm = '<iframe style="display: none;" id="if1" src="'+url+'"></iframe>';
//alert(url);
window.open(url, 'download_window', 'directories=0,status=0,scrollbars=0,resizeable=0,width=1,height=1,top=0,left=0');
window.focus();
}