Results 1 to 10 of 10

Thread: write to system storage

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2021
    Posts
    38

    write to system storage

    aside from using cookies or localStorage, how can I use javascript to write to a file in windows OS, android OS or ios OS ?

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,147

    Re: write to system storage

    The short answer is that you cannot.

    The long answer is that JavaScript is not allowed to access the file system at all and that most (if not all) browsers have security restrictions to prevent this. Just imagine the security concerns if browsers allowed any website to create files.

    If you want to write to disk then you will need to setup a web server and do the IO operations from there. This operation can be triggered by an AJAX request if needed.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2021
    Posts
    38

    Re: write to system storage

    I asked this coz i need to write text to file in an ndroid or ios operating syatem. any advice?

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,147

    Re: write to system storage

    Are hosting a native app?
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2021
    Posts
    38

    Re: write to system storage

    no, just a website. I just dont like that my cookie or my data be deleted when they clear the app cache because it store data about login and registration.

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,147

    Re: write to system storage

    Again, you are not able to just from the browser.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    Member
    Join Date
    Oct 2021
    Posts
    38

    Re: write to system storage

    should i just do it with the native android app?

  8. #8
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,147

    Re: write to system storage

    You could, but an easier approach may be to use cordova with Angular since you have some JavaScript experience.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  9. #9

    Thread Starter
    Member
    Join Date
    Oct 2021
    Posts
    38

    Re: write to system storage

    Quote Originally Posted by dday9 View Post
    You could, but an easier approach may be to use cordova with Angular since you have some JavaScript experience.
    Can I have a learning example ? Oh I think that would be lengthy.

  10. #10
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,147

    Re: write to system storage

    Yeah, thatís a whole learning experience. Iíve been thinking about making a tutorial but man itís a lot.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width