Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果使用了preventDefault,如何继续下载?_Javascript_Jquery - Fatal编程技术网

Javascript 如果使用了preventDefault,如何继续下载?

Javascript 如果使用了preventDefault,如何继续下载?,javascript,jquery,Javascript,Jquery,我有一个jQuery模式用户界面,基本上阻止用户下载文件。我使用preventDefault停止下载管理器的显示。但这会杀死GET 用户单击“同意”后,如何请求继续下载 我已经用谷歌搜索过了,大多数人都在做表单提交。记住文件的URL,然后将其设置为窗口。当用户单击同意时,位置 HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link

我有一个jQuery模式用户界面,基本上阻止用户下载文件。我使用
preventDefault
停止下载管理器的显示。但这会杀死
GET

用户单击“同意”后,如何请求继续下载


我已经用谷歌搜索过了,大多数人都在做表单提交。

记住文件的URL,然后将其设置为
窗口。当用户单击
同意时,位置

HTML:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
    </head>
    <body>
        <a href="http://google.com" id="btn">Button</a>
        <div id="dlg">Continue?</div>
    </body>
</html>​
var dlg$ = $('#dlg').dialog({
    title: 'Confirm action',
    autoOpen: false,
    buttons: {
        'Agree': function() {
            dlg$.dialog('close');
            window.location = dlg$.data('url');
        }
    }
}),
btn$ = $('#btn').on('click', function(e) {
    e.preventDefault();
    dlg$.data('url', this.href).dialog('open');
});​

window.location='UrlToFile'
?一个代码示例可以帮助我们。或者简单到
window.location=$(this.target.href
,其中
如果他感到困惑,this
就是
标记。