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. C-类型转换(陷阱)

    getchar() 返回值为int类型 1.自动类型转换(运算符两边变量类型不同时) 1).两个变量类型自动转换成一样的类型(会根据参数类型自动转换, 而不是直接位转换), 且运算结果也是转换后的类型 ...

  2. Cookie的增删改查

    增加: 第一种方法:Response.Cookies[“UserName”].Value=”张三” Response.Cookies[“UserName”].Expires=DateTime.Now. ...

  3. 电脑 F键(功能键)的具体作用

    F1:如果你处在一个选定的程序中而需要帮助,那么请按下F1.如果现在不是处在任何程序中,而是处在资源管理器或桌面,那么按下F1就会出现Windows的帮助程序.如果你正在对某个程序进行操作,而想得到W ...

  4. rac_安装软件时报版本号过高问题

    原创作品,出自 "深蓝的blog" 博客.欢迎转载,转载时请务必注明下面出处,否则追究版权法律责任. 深蓝的blog:http://blog.csdn.net/huangyanlo ...

  5. Javascript 与 SPA单页Web富应用

    书单推荐 # <单页Web应用:JavaScript从前端到后端> http://download.csdn.net/detail/epubitbook/8720475 # <MVC ...

  6. gitlab 6 安装备忘录

    gitlab 6.2-stable;Ubuntu 13.10;ruby 2.0.0 推荐使用PostgreSQL,MySQL不同版本可能碰到兼容性问题(www.oschina.net/question ...

  7. 经常使用传感器协议3:CJ/T-188 冷热量表协议解析2

        本文详细阐述JY公司冷热量表(记热量)传输协议.并以此说明CJ/T-188协议在厂家详细应用时,并不一致. 本文及兴许文章将对这些不同点予以总结(文中所述协议与日志"CJ/T-188 ...

  8. Atitit.跨语言数据库db  api兼容性 jdbc odbc ado oledb 增强方案

    Atitit.跨语言数据库db  api兼容性 jdbc odbc ado oledb 增强方案 1. 跨语言db api兼容性..1 2. 目前访问数据库的接口很多.比较常用的jdbc odbc 以 ...

  9. 李洪强经典面试题53-Swift

    李洪强经典面试题53-Swift Swift 网上有很多Swift的语法题,但是Swift现在语法还未稳定,所以在这里暂时不贴出语法题,可以自行搜索. Swift和Objective-C的联系 Swi ...

  10. java包命名规则

    package indi/onem.发起者名.项目名.模块名... package pers.个人名.项目名.模块名... package priv.个人名.项目名.模块名... package te ...