.htaccess - Content disposition link conflict -
i use modx evolution , included htaccess file following:
<ifmodule mod_headers.c> <filesmatch "\.jpg$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.jpeg$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.png$"> header append content-disposition "attachment;" </filesmatch> </ifmodule> i have download button each image can downloaded, so:
<div class="box download-box"> <a class="button" href="[*template-variable-image*]">download</a> the above work perfectly.
now added button user see image in full scale in separate browser tab code:
<h2 class="thumb-caption"><span data-href="[*template-variable-image*]" target="_blank">preview</span></h2> now when user clicks "preview" content disposition attachment box appears download. how can "preview" show preview of image way planned , not content download box???
this more html modx question. lot of modern browsers know download attribute in tag.
so throw away .htaccess additions , use
<a class="button" href="[*template-variable-image*]" download>download</a> you use javascript , catch browsers. john culviner has written nice jquery plugin jquery-file-download this.
Comments
Post a Comment