1

I am writing a web application and I am getting some data from a server using jQuery.

I want to save the data in a file on client-side and I tried this using the plugin JQuery.tWFile.js, but get the following exception

Error: A script from http://localhost was denied UniversalXPConnect privileges

How can I fix this? Are there any other better possibilities to save the data that I get from a server in a client-side file?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Dragos
  • 81
  • 2
  • 9

3 Answers3

0

how about using localStorage? link to storage possibilities at mdn

EDIT: I think it has lesser limitations, is also bound to the current domain and exists across browser sessions... only clearing the cache would reset it afaik

Tobias Krogh
  • 3,768
  • 20
  • 14
  • `localStorage` is usually [limited to several megabytes](https://stackoverflow.com/a/2989317/975097), but it's possible to store larger amounts of data using the [IndexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API). – Anderson Green Mar 19 '22 at 21:43
0

The script is failing because your Uri is localhost, this may be a loopback IP... but to your browser it's still a web site. Writing local files is only allowed when browsing a local file using a file:// Uri.

If you can't use a file:// Uri, then you'll have to settle for cookies or localStorage.

Ty H.
  • 905
  • 8
  • 8
-1

It should work if you use file:///path/to/file.html

Yunnosch
  • 26,130
  • 9
  • 42
  • 54