Google跟踪代码管理器破坏了代码的下载属性 [英] Google Tag Manager breaks download attribute on a tag
问题描述
我们遇到的问题是,另存为"对话框中没有自动填充文件.
We are having an issue where the file is not auto-populated on Save-as dialog.
以下标记由JSONToCsvService(library)生成并附加到主体标记.
Below tag is getting generated by JSONToCsvService(library) and appended to body tag.
分析报告
当我们单击此元素时,应在同一窗口中弹出一个另存为"对话框,并预先填充文件名(在上面的示例中为Sample.csv)
When we click on this element it should popup a Save -as dialog in same window and pre populate the file name ( in above case Sample.csv)
如果没有Google跟踪代码管理器,则文件名会在另存为"对话框中正确显示.启用Google跟踪代码管理器后,将下载文件,但不会自动填充文件名.
when there is no Google Tag Manager then file name is shown properly in Save-as dialog. When Google Tag manager is enabled file get downloaded but file name is not auto populated.
推荐答案
我们的链接元素如下所示.
Our link element looked like this.
<a href="data:text/csv;charset=utf-8,%20Messages%20Sent" download="Analytics_Summary.csv">Download File</a>
为此添加了target属性,从而解决了该问题.
Adding target attribute to this fixed the issue.
<a href="data:text/csv;charset=utf-8,%20Messages%20Sent" download="Analytics_Summary.csv" target="_blank">Download File</a>
这篇关于Google跟踪代码管理器破坏了代码的下载属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!