jquery.fileDownload plugin: Success msg alert before actual pdf download completed
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的更多相关文章
- jQuery Validation Plugin学习
http://blog.csdn.net/violet_day/article/details/14109261 jQuery Validation Plugin Demo 一.默认校验规则 (1)r ...
- (转)jQuery Validation Plugin客户端表单证验插件
jQuery Validation Plugin客户端表单验证插件 官方文档:http://jqueryvalidation.org/documentation/ 官方demo:http://jque ...
- jQuery AJAX 方法 success()后台传来的4种数据
JAVA中的四种JSON解析方式详解 jQuery AJAX 方法 success()后台传来的4种数据 1.后台返回一个页面 js代码 /**(1)用$("#content-wrapper ...
- 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 异步 ...
- Using The jQuery Migrate Plugin
jQuery( html [, ownerDocument ] )Returns: jQuery Description: Creates DOM elements on the fly from t ...
- 关于jQuery Form Plugin使用心得
吐槽一下先 好久没开发了,今天遇到一个客户form提交的问题,想把form提交从同步变成ajax的异步方式,在网页接受返回来的数据,使用的是jquery from插件,于是网上搜了一圈,博客园,csd ...
- Showbo.Msg.alert
注意alert,confirm及prompt并不同于系统的,这个是用层模仿的,并不能挂起程序的执行 所以如果需要在确认后执行相关的操作,需要在配置文件中传递回调函数fn 按钮只提供yes和no两个 S ...
- 30个非常流行的提示信息插件(jQuery Tooltip Plugin)
在网站的设计中,提示信息是非常细微的功能,但是起着非常重要的作用.如果你的网站中提示信息做的比较好,会给浏览者留下非常深刻的印象,同时也会起到非常好的网站宣传效果,下面介绍了30个比较流行提示信息插件 ...
- JQuery多媒体插件jQuery Media Plugin使用详解
malsup jquery media plugin 该插件可以播放多种类型的多媒体文件包括:Flash, Quicktime, Windows Media Player, Real Player, ...
随机推荐
- 1高并发server:多路IO之select
1 select A:select能监听的文件描写叙述符个数受限于FD_SETSIZE,一般为1024.单纯改变进程打开 的文件描写叙述符个数并不能改变select监听文件个数 B:解决1024 ...
- Oracle创建DataBase Links
-- Drop existing database link drop database link GJA_CFMDM_LINK;-- Create database link create data ...
- Problem-1001:Sum Problem
Sum Problem Sample code : #include <stdio.h> int main() { int i,n; int sum; while(scanf(" ...
- 设置U盘启动
利用快捷键来设置U盘启动,利用快捷键启动相对来说比较简单快捷,推荐大家使用(重要提醒:选择热键前,请先插入U盘) 组装机主板 品牌笔记本 品牌台式机 主板品牌 启动按键 笔记本品牌 启动按键 台式机品 ...
- webpack-dev-server 无法通过ip访问的问题
使用Vue-cli生成的webpack脚手架,之前一直是可以通过本地ip + 端口来访问的.今天忽然不可以,百度一下才知道缺少了host参数. 打开package.json.在.scripts.dev ...
- [na]整一下博客面貌--cnblog css定制
前言 之前觉得cnblog排版乱. 而csdn对word兼容性较好一些.所以就转到csdn了. 后来看到别人的cnblog排版挺好,如 等效果. 参考资料 http://www.cnblogs.com ...
- iconv c 代码学习
(struct stringpool_t *)0)->stringpool_str15 含义为: 1.创建一个结构体stringpool_t 指针(struct stringpool_t *) ...
- C++ regex
我TM看了很久的文档,还是无法理解为什么我用MinGW GCC 4.8.1编译的C++11 <regex>总是抛出异常:regex_error 还是下载boost regex吧 或者c语言 ...
- ajax请求后台返回map类型并如何展示
前台jsp或者ftl文件接收返回结果: <input type="hidden" name="selectedModelListStr" id=" ...
- centos6.5下redis的安装与配置
参照官网描述(https://redis.io/download),linux下redis安装步骤如下: $ wget http://download.redis.io/releases/redis- ...