链接下载肯定 [英] Links that download for sure

查看:95
本文介绍了链接下载肯定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我多次遇到要下载文件的链接问题。在一个

的情况下,我有一个扩展名不同于txt的文本文件,如果

用户安装了相关的应用程序,可以用它打开,

或以其他方式下载。问题是在某些客户端,浏览器

显示了文件,这不是预期的目的,对访问者来说是无用的。

另一次我遇到了更常见的挑战,即允许用户下载

pdf文件而不是在浏览器中查看它们,以防他们安装了

插件。


我知道一个常见的答案就是压缩文件,但是有些用户......你知道,甚至拉链自信都不自信可以这么说。


如何通过客户端解决方案确保链接触发

下载?我试图寻找一个javascript函数,但我没有提前

它所以我找不到办法。


谢谢

I have had problems several times with links to files to download. In one
case I had a text file with different extension than txt, that, in case the
user has the associated application installed, it could be opened with that,
or otherwise downloaded. The problem was that in some clients, the browser
displayed the file, wich was not the intended purpose and was useless for
the visitors.

Another time I had the more common challenge of allowing users downloading
pdf files instead of viewing them in their browser in case they had the
plugin installed.

I know a common answer would be to zip the files, but some users... you
know, are not even zip self confident so to speak.

How can I make sure, with a client side solution, the link triggers a
download? I tried to look for a javascript function but I am not advanced on
it so I couldn''t find a way.

Thanks

推荐答案

2004年10月30日星期六14:28:41 -0300,Simon Templar< po ******** @ gmx.co.uk> ;

写道:


[snip]
On Sat, 30 Oct 2004 14:28:41 -0300, Simon Templar <po********@gmx.co.uk>
wrote:

[snip]
如何通过客户端解决方案确保该链接触发
下载?我试图寻找一个javascript函数,但我没有进展它,所以我找不到办法。
How can I make sure, with a client side solution, the link triggers a
download? I tried to look for a javascript function but I am not
advanced on it so I couldn''t find a way.




这是因为这是不可能的。请参阅(clj)常见问题

(< URL:http://jibbering.com/faq/>)。


Mike


-

Michael Winter

替换.invalid与.uk通过电子邮件回复。



That''s because it''s not possible. See the (clj) FAQ
(<URL:http://jibbering.com/faq/>).

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


在alt。 www.webmaster,comp.lang.javascript Simon Templar说:
In alt.www.webmaster,comp.lang.javascript Simon Templar said:
我多次遇到过要下载文件的链接问题。


您无法控制点击文件链接时发生的事情

并且您无法强制执行任何操作。如果一个人想下载文件

而不是在浏览器窗口或其他应用程序中打开它

他们应该知道该做什么(你不要知道他们想要做什么

你不应该猜测他们。)


如果你的访客不知道如何下载文件没有打开它

浏览器提供常用浏览器的说明和那些

显示在你的服务器统计数据中。

在一个案例中我有一个扩展名不同于txt的文本文件,


idiot

问题是在某些客户端,浏览器显示文件,
不是预期的目的,对访客来说毫无用处。


如果你想要一个保存对话框然后改变*你的*偏好。

另一次我有更常见的挑战,允许用户下载
pdf文件而不是在浏览器中查看它们
I have had problems several times with links to files to download.
you have no control over what happens when a link to a file is clicked
and you cant force anything. if a person wants to download the file
instead of opening it in the browser window or in some other application
they should know what to do (and you don''t know what they want to do so
you shouldn''t try to guess for them).

if your visitors do not know how to download a file without opening it
in the browser supply instructions for the common browsers and those
shown in your server stats.
In one case I had a text file with different extension than txt,
idiot
The problem was that in some clients, the browser displayed the file,
wich was not the intended purpose and was useless for the visitors.
if you want a "save dialog" then change *your* preferences.
Another time I had the more common challenge of allowing users downloading
pdf files instead of viewing them in their browser




acrobat可以选择关闭浏览器集成。很简单,你这个b $ b不需要做任何事情。

-


voicesofthelittle



acrobat has the option to turn off browser integration. simple, you
don''t need to do anything.
--

v o i c e s o f t h e l i t t l e


brucie写道:
在alt。 www.webmaster,comp.lang.javascript Simon Templar说:
In alt.www.webmaster,comp.lang.javascript Simon Templar said:



[snip]


[snip]

In一个案例我有一个文本文件,其扩展名不同于txt,
In one case I had a text file with different extension than txt,



idiot


idiot



[snip]


真的吗?那么你用逗号

分隔值给你一个ASCII文件的扩展名是什么?对我来说,如果用户没有将.csv分配给任何特定应用程序,那将是.csv(或某些人的.csf)和



(Windows将默认情况下将其分配给Excel如果你有Excel)它将在浏览器中显示为文本。


还有更多的例子,请不要判断得这么快,或者说用你的语言粗鲁无礼。


Zif。


[snip]

Really? So what extension would you give an ASCII file with comma
separated values? Seems to me that would be .csv (or .csf for some) and
if the user doesn''t have .csv assigned to any particular application
(Windows will assign it to Excel by default IF you have Excel) it will
be displayed in the browser as text.

There are many more examples, please don''t be so quick to judge, or so
rude in your language.

Zif.


这篇关于链接下载肯定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆