locked
New to Windows Apps Store, but not HTML Javascript

    Question

  • Hi, New to posting in forums, But there's a first time for everything

    I'm working on an app in HTML/Javascript, a text editor, with load/save feature, How would I go about saving the data in a user folder "Like documents or downloads" to be loaded again when the app is next run and user clicks load

    Also any refference/tutorials you can link me will be helpfu


    Wednesday, January 22, 2014 3:27 PM

Answers

  • It depends on whether you consider that data "app data," which is tied to the existence of the app, and "user data" which is not. That is, app data is stored in an app-specific folder that is cleaned up when the app is uninstalled. User data, on the other hand, is stored in some other location (e.g. a library) and would remain in place like other documents if the app is uninstalled.

    You can also consider direct cloud storage, but on a Windows 8.1 machine, you can have user data default to the user's SkyDrive folder, which accomplishes the same thing. In these cases you invoke the "File Picker" to ask the user for a save location, and set the default to the Documents Library which will default to SkyDrive.

    With app data you also have the option to automatically roam up to 100KB of data, if you're talking of just saving smaller bits of transient data that you'd want the user to see on other devices.

    The subjects of app data and user data are ones that I cover in my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, which you can find in preview form on http://aka.ms/BrockschmidtBook2. Look specifically at Chapters 10 and 11, though you should peek at Chapter 1 for an overview of storage locations.

    Wednesday, January 22, 2014 3:50 PM

All replies

  • It depends on whether you consider that data "app data," which is tied to the existence of the app, and "user data" which is not. That is, app data is stored in an app-specific folder that is cleaned up when the app is uninstalled. User data, on the other hand, is stored in some other location (e.g. a library) and would remain in place like other documents if the app is uninstalled.

    You can also consider direct cloud storage, but on a Windows 8.1 machine, you can have user data default to the user's SkyDrive folder, which accomplishes the same thing. In these cases you invoke the "File Picker" to ask the user for a save location, and set the default to the Documents Library which will default to SkyDrive.

    With app data you also have the option to automatically roam up to 100KB of data, if you're talking of just saving smaller bits of transient data that you'd want the user to see on other devices.

    The subjects of app data and user data are ones that I cover in my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, which you can find in preview form on http://aka.ms/BrockschmidtBook2. Look specifically at Chapters 10 and 11, though you should peek at Chapter 1 for an overview of storage locations.

    Wednesday, January 22, 2014 3:50 PM
  • See Managing app data and Launching, resuming and multitasking

    You'll save your data periodically (probably to a file) and the app state when it suspends (probably in app settings). When the app starts check the settings to know the last state it was in (what file was being edited, on which page, etch.) and restore that.

    Wednesday, January 22, 2014 3:51 PM
    Moderator
  • Thanks for the reply,  the data to be saved would be considered as a file the user can then reload (Like a file.txt) as an example could be stored in EG: Desktop?
    not wanting to use cloud storage just yet
    I'll take a good look at that book, Thanks 
    Wednesday, January 22, 2014 3:57 PM
  • You've linked me to C++/C# Guides, I've not learnt any of that just yet, Only know the basics in Javascript for now
    Wednesday, January 22, 2014 3:58 PM
  • Sorry. You said you were using Visual Basic. Can you please clarify? Either way the concepts are the same and you can find the same docs in both the HTML and XAML sections.

    You can let the user choose where to save with a FileSavePicker and use an AccessCache object to remember it across instances.

    Wednesday, January 22, 2014 4:22 PM
    Moderator
  • I haven't learnt VB Yet, I can clarify I am learning HTML/XAML/JavaScript

    can you link me to a guide on how I would give the user the option to save? or shed some insight as to how it's done?
    Wednesday, January 22, 2014 4:25 PM
  • You would use either HTML (along with JavaScript) or Xaml (along with VB, C#, or C++). You cannot mix HTML and Xaml in the same app.

    It sounds like you're trying to use HTML/JavaScript. You might want to edit your initial post in this thread to say that rather than Visual Basic, and I'll move you back to that forum.

    See Working with data and files in the Developing apps (JavaScript)documentation for information on saving. Also look at the File access sample           

    I'll add my recommendation for anybody doing Windows Store app development in HTML/JavaScript to read Kraig's book. 

    --Rob

    Wednesday, January 22, 2014 4:45 PM
    Moderator
  • I've not found any resources on how to save files using HTML/Javacsript, but will take a long read at the links you have give me
    Looking into learning VB/C#/C++ this month as it seems I will benefit more from it
    I've reworded my question a bit better now, And I would recommend his book too, Gave me a bit more of an insight into it all 
    Wednesday, January 22, 2014 4:58 PM