/    Sign up×
Community /Pin to ProfileBookmark

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 [I].txt[/I] 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!

to post a comment
HTML

11 Comments(s)

Copy linkTweet thisAlerts:
@ryanbutlerSep 01.2012 — 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.
Copy linkTweet thisAlerts:
@jedaisoulSep 01.2012 — 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.
Copy linkTweet thisAlerts:
@ashydrauthorSep 01.2012 — 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.[/QUOTE]

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 [i]must[/i] have arisen before.. Somewhere! :p

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.[/QUOTE]


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.
Copy linkTweet thisAlerts:
@ryanbutlerSep 01.2012 — 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 [i]must[/i] have arisen before.. Somewhere! :p
[/QUOTE]


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.
Copy linkTweet thisAlerts:
@ashydrauthorSep 02.2012 — 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.[/QUOTE]

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.
Copy linkTweet thisAlerts:
@ryanbutlerSep 02.2012 — Nobody will turn JavaScript off, and if they do, they're shooting only themselves in the foot. [/QUOTE]

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.
Copy linkTweet thisAlerts:
@jedaisoulSep 02.2012 — 
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.
[/QUOTE]

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.
Copy linkTweet thisAlerts:
@jalarieSep 10.2012 — 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
Copy linkTweet thisAlerts:
@ZABISep 11.2012 — 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
Copy linkTweet thisAlerts:
@jalarieSep 11.2012 — ... writing directly to users' files system is not allowed in browsers ....[/QUOTE]

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
Copy linkTweet thisAlerts:
@ZABISep 12.2012 — haha gr8 its also possible in JScript with same scenario. that's why i used the word [B]directly[/B]

and FYI: its is done via ActiveX FileSystemObject and is not even built-in feature of Visual Basic Script or JScript ?
×

Success!

Help @ashydr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...