Re: storing locally web form data submitted on a local browser
Re: storing locally web form data submitted on a local browser
- Subject: Re: storing locally web form data submitted on a local browser
- From: JJ <email@hidden>
- Date: Tue, 29 Jan 2002 20:51:28 +0100
>
i made a lot of web sites, and for a small exhibition we want to put a web
>
site on the disk of an iMAC which will be off-line (no internet connexion
>
in the small exhibition place);
>
however there is a page with a form where for making a referendum... the
>
form 'submit' button defined in javascript sends as usuall all the form
>
data on internet to some e-mail address...
>
>
with the imac disconnected to internet, this will not work...
>
is there a way to keep the form data on the local hard disk by calling from
>
javascript an applescript which would do the job of storing these in
>
files... either in Explorer or Netscape
It's pretty easy to a script (applet/droplet) receive data from a browser
"offline". Simply configure it as a helper application for a new protocol
(your own protocol, such as "
mailto:"; i. e., "yvesbernard:"). A weeks ago I
was developing just this: receive url-encoded strings, from browser to app
(parse results, then make something with the data).
If you know japanese, take a look at this interesting page (AppleScript
Runner):
http://www.alles.or.jp/~factory/mac/mac.html
Otherwise, take a look to my project (mirrored in ScriptBuilders):
http://macscripter.net/sb_search.t?keyword=run+ascript&go=Search
Basically, the browser sends to the protocol helper (your app) the apple
event "GURLGURL" (open location, getUrl,...). Depending on the browser
you'll receive the event "WWW!OURL" (openUrl) and, if you can't handle it,
then it will send "GURLGURL".
You need only handle this event with a simple handler:
on <<event GURLGURL>> (given_string)
-- "given_string" is the link clicked by the user (encoded):
-- i.e.>> "yvesbernard:store this data"
end <<event GURLGURL>>
Also, you can configure your browser to d/l some archive to the user-disk
(your own) and post-proccess it with your app. Then, the browser will send
you a standard "open" command that you should handle as normally in a
droplet:
on open alias_list
-- do some stuff with the files
end open
The BIG problem is about the string passed to you by the browser. If you
want your app to parse data received from ALL browsers then... good luck!
Every browser encode/decode the data to its convenience and, testing the
same page, your script will receive different strings from IE, Netscape,
iCab, Communicator, Opera...
I've been working about this and the only solution is parsing the data via
javascript before sending it to the "protocol helper". You can see some
examples at the link above (donwloading "Run ASCRIPT").
So, good luck!
JJ