-1

I am developing a Hybrid Mobile app using HTML5, CSS and Javascript. I create apk using PhoneGap. I installed the app in a phone. The Problem is that when I click download, the file is opened and not downloaded.

My code is

<a data-toggle="tooltip" title="Download filename" href="mywebsiteURL/Upload/filename.extension" >

Please help me.

Davide Pastore
  • 8,678
  • 10
  • 39
  • 53

1 Answers1

0

Try this:

<a data-toggle="tooltip" title="Download filename" href="mywebsiteURL/Upload/filename.extension" target="_blank">

However, if the file extension is known for browser (such as images) it opens within the browser and you need to send header (via php for example) in order to force it to download. More info on server-side scripting

Community
  • 1
  • 1
Amin
  • 763
  • 7
  • 22
  • How do I send header?? I don't know php. Is there any way I can do it without php? Thanks a lot for your help. @Amin – Vincent Paukgyi Mar 16 '15 at 04:14
  • @VincentPaukgyi You can do it with any language but you need to setup a server. I add a more info link at the end of the answer. – Amin Mar 16 '15 at 17:07