1

I have a JavaScript code that is capturing mouse co-ordinates(X, Y and timestamps) from UI. I want to write this information into a file (xml/.txt etc.)so that it can be used for further processing using another toolkit.

Since apparently we cannot access client-side file system using JavaScript, I was looking for a way to do this. I don't have much experience with JavaScript, I tried searching and AJAX seems to be a solution. Any other solution is most welcomed.

My question is - Can we load AJAX locally so that this processing can be done without interacting with Web-server ? Since if this can be done I just need to do file handling using other code (C#) so that I can use recorded data .

I don't want to use HTML5, since I have a custom browser built on top of qt 4.6 which doesn't have support for HTML5 File API.

P.S. - I don't have any other functionality on the page, it's just a blank "index.html" that is executing a script to capture mouse co-ordinates and display them.

TheZelus
  • 390
  • 2
  • 19
  • Without further customizing your browser, I think the best you're going to get is to copy the data to the clipboard and paste it into a file manually; either by writing it to a `textarea` and copying, or by [using a small flash object in the page](http://stackoverflow.com/questions/400212/how-to-copy-to-clipboard-in-javascript/665577#665577) – jches Aug 09 '11 at 22:47
  • Manually.....ummmmmm that doesn't sound like what I want, actually I'm trying to develop an application that recognizes alphabet that user draws on screen using mouse. My recognizer is in C# and I just wanted to extract out co-ordinates from UI so they can be fed to recognizer. – TheZelus Aug 09 '11 at 22:57
  • How do you expect to run your C# code on the client's machine? Assuming your stuck with a browser, you'll need to pass the geometry data to the server in order to execute your C# character-recognition. – timdev Aug 09 '11 at 23:03
  • @timdev - I'm not running my C# code on client machine, I agree with you that I will be passing the data to recognizer that will be on server. I don't want to get restricted with a particular language. Since if I can extract the data out of UI I can send it to any kind of application that is running server (C# /Java...). At present my focus is to extract data on client-side. – TheZelus Aug 09 '11 at 23:10

1 Answers1

1

The cheap-and-cheerful method is to use window.name, which can hold a string value of several megabytes. This is not protected space and can be used by any web page's script - so it's not really "safe" for general consumption without encryption, but for hacking around it's easy, fast and convenient. Stringify your data and pop it in.

Diodeus - James MacFarlane
  • 107,156
  • 31
  • 147
  • 171
  • You can post the data back to the server and save the file there. Browser security prevents access to the local filesystem *period*. Java, Flash and Active-X can be used to get around this limitation. – Diodeus - James MacFarlane Aug 09 '11 at 23:40