download file instead of opening in browser

29 views
Skip to first unread message

Sherry Rose Ong

unread,
Jul 2, 2015, 12:15:07 PM7/2/15
to urlre...@googlegroups.com
Hi,

How can I automatically download a file(.xlsm) instead of opening in browser?
Thank you.

Regards,
Sherry 

Avlesh Singh

unread,
Jul 3, 2015, 2:33:33 AM7/3/15
to UrlRewrite
I don't think this problem can be solely solved with URF.

Here's a code sample of how you can do it in a Java servlet - http://stackoverflow.com/questions/6520231/how-to-force-browser-to-download-file (it basically boils down to setting a few response headers and writing the file content to outputstream.

In the HTML5 world, you can simply do this by adding a "download" attribute inside the link for the browser to trigger a download prompt instead of opening it inside the browser. Something like the below:

<a download="/path/to/file.xlsm">Download</a>

Avlesh
WebEngage

--
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urlrewrite+...@googlegroups.com.
To post to this group, send email to urlre...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/urlrewrite/892eb0fe-1479-4636-9335-2cfcdcb5a855%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages