www.webdeveloper.com
Results 1 to 12 of 12

Thread: Storing data locally, on a client-side webpage

  1. #1
    Join Date
    Aug 2012
    Posts
    3

    Storing data locally, on a client-side webpage

    Hola!

    For a number of weeks now I've been attempting to complete this task, however I'm having major issues in doing so - any help will be greatly appreciated!

    The issue I'm having lies with Client-Side Programming. Given I usually concentrate on server-side code like PHP, front-end clearly isn't my forte.

    I have a form (just a simple one: Name, Shift, Comment) built with nothing fancy, just HTML and CSS. I need to store data submitted using this form in a .txt file, that can be read back. This 'website' (term used loosely!) has been created on an external drive, and therefore has no PHP or ASP permissions.

    I've tried the ActiveXObject approach; no luck.
    I've tried the FileSystem method; no luck.

    The browser used is IE7 and it isn't possible to use anything else.

    I assume that if possible, I'll have to use Javascript to do this, as I'm unaware of any other language that could possibly be used. jQuery or any other plugin isn't available to use on the system.

    Again, any help; greatly appreciated! Thanks a lot!

  2. #2
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    Though it may not be possible, you need to re-evaluate project requirements. JavaScript can't do it, b/c you need to access the file I/O, & that is only possible with a compiled language such as .NET, or as you mentioned PHP.
    Ryan Butler

    Ryan Butler.org

  3. #3
    Join Date
    Mar 2012
    Posts
    1,560
    Could you send the data to an external (or internal) PHP web page or script on a server that has PHP permissions? If so, you could output as a txt file there.

    I suspect that the "action" parameter of a form supports absolute addressing. If so, that may be your only solution.
    Last edited by jedaisoul; 09-01-2012 at 01:46 PM.

  4. #4
    Join Date
    Aug 2012
    Posts
    3
    Quote Originally Posted by ryanbutler View Post
    Though it may not be possible, you need to re-evaluate project requirements. JavaScript can't do it, b/c you need to access the file I/O, & that is only possible with a compiled language such as .NET, or as you mentioned PHP.
    I thought as much. I refuse, however, to believe that nobody on the entire web has come up with a solution to an issue that must have arisen before.. Somewhere!

    Quote Originally Posted by jedaisoul View Post
    Could you send the data to an external (or internal) PHP web page or script on a server that has PHP permissions? If so, you could output as a txt file there.

    I suspect that the "action" parameter of a form supports absolute addressing. If so, that may be your only solution.
    Although this would be a great idea, I'm I'm afraid not.

    Could you please expand on what you mean by 'absolute addressing'? If you're asking if the 'action' parameter directs to another page, no it doesn't - a button is used below the form that runs JS via onClick.

  5. #5
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    Quote Originally Posted by ashydr View Post
    I thought as much. I refuse, however, to believe that nobody on the entire web has come up with a solution to an issue that must have arisen before.. Somewhere!
    Using JavaScript to write to a I/O directory is not an option. It would have security holes all around it, not to mention, if anyone decides to turn off JavaScript, your solution is defunct. Why can't you use LAMP on this external hard drive? To me, LAMP running locally is really the only viable option. If you use LAMP locally on this hard drive, and give the directory you want to write to full permissions, you should be fine.
    Ryan Butler

    Ryan Butler.org

  6. #6
    Join Date
    Aug 2012
    Posts
    3
    Quote Originally Posted by ryanbutler View Post
    Using JavaScript to write to a I/O directory is not an option. It would have security holes all around it, not to mention, if anyone decides to turn off JavaScript, your solution is defunct. Why can't you use LAMP on this external hard drive? To me, LAMP running locally is really the only viable option. If you use LAMP locally on this hard drive, and give the directory you want to write to full permissions, you should be fine.
    Nobody will turn JavaScript off, and if they do, they're shooting only themselves in the foot.

    I can't use any sort of server-side code on this system. It simply isn't an option. Unfortunately, I may have to give up on this idea, and simply turn the form into a MAILTO option. Shame.

    Thank you for all your help though, both of you. Greatly appreciated.

  7. #7
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    Quote Originally Posted by ashydr View Post
    Nobody will turn JavaScript off, and if they do, they're shooting only themselves in the foot.
    LOL, bad assumption to make. I can remember a particular someone (surely not me) having that exact same premise. My point was, relying on JavaScript for this is not the right idea or path. Hope you get it figured out.
    Ryan Butler

    Ryan Butler.org

  8. #8
    Join Date
    Mar 2012
    Posts
    1,560
    Quote Originally Posted by ashydr View Post
    Although this would be a great idea, I'm I'm afraid not.

    Could you please expand on what you mean by 'absolute addressing'? If you're asking if the 'action' parameter directs to another page, no it doesn't - a button is used below the form that runs JS via onClick.
    Abolute adressing is where you give the full URL of the web page or script that is to process the form input. E.g. Assuming there is a php script called "textdump.php" in public_html on a site called "mysite.com", then (using absolute addressing) the form command should be something like:

    <form action="http://www.mysite.com/textdump.php" method=post>

    I've just tested it by submitting a form input from my local development site to my live site and it worked. The live script received the post, converted it to an email which it sent to my email account with hotmail. It also logged it to a text file. So you can even have email notifications if you wish. All written in PHP and HTML.

  9. #9
    Join Date
    Nov 2002
    Location
    Flint, Michigan, USA
    Posts
    594
    Use Visual Basic Script. It will only work within the Internet Explorer browser, and it will ask the user's permission before such action.

    You can try it out here:
    http://spruce.flint.umich.edu/~jalarie/jaa_kcd2.htm
    Please give me a hand at http://www.gofundme.com/bkzr98.

  10. #10
    Join Date
    Mar 2009
    Posts
    452
    hey, why dont you give a try to HTA (HTML Applications). you can get the job done with JScript via FileSystemObject. actually writing directly to users' files system is not allowed in browsers due to security on the web. however you can use HTA as it runs as an application rather than a webpage thus has more power.

    find out more on Google

  11. #11
    Join Date
    Nov 2002
    Location
    Flint, Michigan, USA
    Posts
    594
    Quote Originally Posted by ZABI View Post
    ... writing directly to users' files system is not allowed in browsers ....
    It is allowed using Visual Basic Script within the Internet Explorer browser with user permission. Try it out here: http://spruce.flint.umich.edu/~jalarie/jaa_kcd2.htm
    Please give me a hand at http://www.gofundme.com/bkzr98.

  12. #12
    Join Date
    Mar 2009
    Posts
    452
    haha gr8 its also possible in JScript with same scenario. that's why i used the word directly

    and FYI: its is done via ActiveX FileSystemObject and is not even built-in feature of Visual Basic Script or JScript
    Last edited by ZABI; 09-12-2012 at 04:55 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles