facebook

download file feature

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #334917 Reply

    upasana
    Member

    I have an anchor tag

    
    <a download="temp.csv" id="temp" href="">Download Temp</a>

    I am using a javascript function to populate the href value

    the function is like

    
     $('#temp').attr('href','data:application/webcsv;charset=utf8,' + encodeURIComponent(csvData));

    This works fine on pc browsers. But not working on mobile browser.

    What i am doing is create a csv file dynamically and want it download it to some location.

    Thanks.

    #334929 Reply

    support-michael
    Keymaster

    @upasana

    >But not working on mobile browser.

    0) what desktop browsers are you referring to?

    1) Which mobile browser(s) are you referring?

    Do a google on the specific browser and ensure that it understands mimetypes of application/webcsv.

    #334938 Reply

    upasana
    Member

    I have tested the code on

    1. pc web browsers : a. chrome, b. firefox. c.safari
    2. in mobile web browsers : chrome – not working
    3. i have also tried creating a native application for android. And it was not working.

    The app is going to be a native application. So is there a provision to save files, maybe to a fixed folder.

    #334951 Reply

    support-michael
    Keymaster

    @upasana

    Thanks for the browser info. Mobile browsers do not naturally support explicit file download.
    Since you are developing a native application, an alternative approach is to fetch the file(s) directly and save to disk using the Cordova/PhoneGap api.

    Note: that the Test Center does not simulate the cordova api so you have to test from a native app.

    See the Cordova/PhoneGap api here
    http://docs.phonegap.com/en/2.2.0/

    Here are a couple of examples (google can find you many more):
    http://blog.safaribooksonline.com/2012/02/29/phonegap-storing-and-retrieving-with-the-filesystem/

    https://gist.github.com/1904992

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: download file feature

You must be logged in to post in the forum log in