内容配置链接冲突

时间:2015-07-07 21:12:56

标签: .htaccess modx content-disposition modx-evolution

我使用MODx Evolution,并将以下内容包含在我的htaccess文件中:

<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>

我有一个可以下载的每个图像的下载按钮,如下所示:

<div class="box download-box">
                        <a class="button" href="[*template-variable-image*]">Download</a>

以上代码完美无缺。

现在,我已添加了另一个按钮,供用户使用以下代码在单独的浏览器标签中全面查看图像:

<h2 class="thumb-caption"><span data-href="[*template-variable-image*]" target="_blank">PREVIEW</span></h2>

现在,当用户点击&#34; PREVIEW&#34;出现内容处置附件框以供下载。如何获得&#34; PREVIEW&#34;以我计划的方式显示图像的预览而不是内容下载框???                     

1 个答案:

答案 0 :(得分:0)

这是一个HTML而不是MODX问题。很多现代浏览器都知道标签中的download attribute

抛弃.htaccess添加并使用

<a class="button" href="[*template-variable-image*]" download>Download</a>

您也可以使用javascript来捕获所有浏览器。 John Culviner为此编写了一个不错的jQuery插件jquery-file-download

相关问题