Currently , I use jquery fileDownload plugin to download multiple pdf that in a list page, which every single hyperlink can download one pdf file.
When i click 1st link, every thing occured ok, but when click 2nd or other link, success msg alert before actual pdf download completed. It confused me a few days...
Finally, i find the reason and got a way to resolve the problem.

We can check source code in jquery.filedownload.js, when document.cookie contains value 'fileDownload=true', it will pop up success msg. The key is when finish the 1st download, the cookie not expired!!! So when you click second ,third link,msg alert before download.
I tried set cookie 's maxAge ,but it still same error..

The thing we do is every download we need create a unique cookie.

Thanks http://gruffcode.com/2010/10/28/detecting-the-file-download-dialog-in-the-browser/,
We can generating a token value using the current timestamp as the value of 'filedownload', This token can really be any arbitrary string value, but we do want to try and make it unique per request coming from the same browser, and using the timestamp is a pretty easy way to do this. We take that token and add it to the form within that hidden field that we created. This will ensure that the token value gets submitted up to the server (more on this later).

jquery.fileDownload plugin: Success msg alert before actual pdf download completed的更多相关文章

  1. jQuery Validation Plugin学习

    http://blog.csdn.net/violet_day/article/details/14109261 jQuery Validation Plugin Demo 一.默认校验规则 (1)r ...

  2. (转)jQuery Validation Plugin客户端表单证验插件

    jQuery Validation Plugin客户端表单验证插件 官方文档:http://jqueryvalidation.org/documentation/ 官方demo:http://jque ...

  3. jQuery AJAX 方法 success()后台传来的4种数据

    JAVA中的四种JSON解析方式详解 jQuery AJAX 方法 success()后台传来的4种数据 1.后台返回一个页面 js代码 /**(1)用$("#content-wrapper ...

  4. http://www.vaikan.com/docs/jquery.form.plugin/jquery.form.plugin.html#getting-started

    http://www.vaikan.com/docs/jquery.form.plugin/jquery.form.plugin.html#getting-started Jquery.Form 异步 ...

  5. Using The jQuery Migrate Plugin

    jQuery( html [, ownerDocument ] )Returns: jQuery Description: Creates DOM elements on the fly from t ...

  6. 关于jQuery Form Plugin使用心得

    吐槽一下先 好久没开发了,今天遇到一个客户form提交的问题,想把form提交从同步变成ajax的异步方式,在网页接受返回来的数据,使用的是jquery from插件,于是网上搜了一圈,博客园,csd ...

  7. Showbo.Msg.alert

    注意alert,confirm及prompt并不同于系统的,这个是用层模仿的,并不能挂起程序的执行 所以如果需要在确认后执行相关的操作,需要在配置文件中传递回调函数fn 按钮只提供yes和no两个 S ...

  8. 30个非常流行的提示信息插件(jQuery Tooltip Plugin)

    在网站的设计中,提示信息是非常细微的功能,但是起着非常重要的作用.如果你的网站中提示信息做的比较好,会给浏览者留下非常深刻的印象,同时也会起到非常好的网站宣传效果,下面介绍了30个比较流行提示信息插件 ...

  9. JQuery多媒体插件jQuery Media Plugin使用详解

    malsup jquery media plugin 该插件可以播放多种类型的多媒体文件包括:Flash, Quicktime, Windows Media Player, Real Player, ...

随机推荐

  1. Linux rm 删除指定文件外的其他文件 方法汇总

    一.Linux下删除文件和文件夹常用命令如下: 删除文件: rm file 删除文件夹: rm -rf dir 需要注意的是, rmdir 只能够删除 空文件夹 . 二.删除制定文件(夹)之外的所有文 ...

  2. 深入分析JavaWeb Item22 -- 国际化(i18n)

    一.国际化开发概述 软件的国际化:软件开发时,要使它能同一时候应对世界不同地区和国家的訪问,并针对不同地区和国家的訪问.提供对应的.符合来訪者阅读习惯的页面或数据. 国际化(international ...

  3. Linux禁止非WHEEL用户使用SU命令

    通常情况下,一般用户通过运行"su -"命令.输入正确的rootpassword.能够登录为root用户来对系统进行管理员级别的配置. 可是.为了更进一步加强系统的安全性,有必要建 ...

  4. Hive 差集运算

    差集定义:一般地,设A,B是两个集合,由所有属于A且不属于B的元素组成的集合,叫做集合A减集合B(或集合A与集合B之差). 类似地,对于集合A,B,我们把集合{x/x∈A,且x¢B}叫做A与B的差集, ...

  5. nodejs 获取指定路径下所有的文件夹名

    示例:获取 ./components 下所有的文件夹名称 let components = [] const files = fs.readdirSync('./components') files. ...

  6. Atitit.数据库存储引擎的原理与attilax 总结

    Atitit.数据库存储引擎的原理与attilax 总结 1. 存储引擎是什么1 2. 其它数据库系统(包括大多数商业选择)仅支持一种类型的数据存储2 3. 表的存储有三个文件:结构+数据+索引2 4 ...

  7. hdu 1829 &poj 2492 A Bug's Life(推断二分图、带权并查集)

    A Bug's Life Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...

  8. 蓝桥杯 如何计算 X^X = 10 来求X呢?

    题目中有说道:X的取值范围大于2小于3 高数书上中方程的近似解有讲到到:(同济第六版180页) ln(x^x)- ln(10)=0; x*ln(x) -ln(10)=0; 假设:F(x) =  X*l ...

  9. ThreadLocal使用方法

      创建一个Bean,通过不同的线程对象设置Bean属性,保证各个线程Bean对象的独立性.   /**  * Created by IntelliJ IDEA.  * User: leizhimin ...

  10. iOS使用AVCaptureSession自定义相机

    关于iOS调用摄像机来获取照片,通常我们都会调用UIImagePickerController来调用系统提供的相机来拍照,这个控件非常好 用.但是有时UIImagePickerController控件 ...