.htaccess 内容处置链接冲突

.htaccess 内容处置链接冲突,.htaccess,modx,content-disposition,modx-evolution,.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-Dispos

我使用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>
预览
现在,当用户单击“预览”时,将显示内容处置附件框以供下载。如何获得“预览”以按我计划的方式显示图像预览,而不是内容下载框???
这与其说是一个MODX问题,不如说是一个HTML问题。许多现代浏览器都知道A标记中的内容

所以扔掉.htaccess添加和使用

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

您还可以为此使用javascript并捕获所有浏览器。John Culviner为此编写了一个很好的jQuery插件