Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing settings from an ini file to a javascript file

Status
Not open for further replies.

SuperSal

Programmer
Mar 13, 2007
33
Hi everyone, I am currently trying to create an interface in Javascript. I have created an ini file which contains the text to be used for the options in comboboxes on a form. My problem is how to access items in the ini file from the javascript. Does anybody know if this can be done?

Thanks
Sally
 
Honestly it wouldnt be my choice but basically it will form a base for being reused by lots of different interfaces once its developed. Maybe i will just put them as variables in a javascript file and access them that way if its too difficult using an ini file.
Thanks
 
Sally said:
...if its too difficult using an ini file.
Not only is it too difficult - it's not possible using standard javascript.

Feherke said:
...JavaScript has no access to the file system...
You can use an ActiveX object to access the file system when using IE (for Windows). You can use Java to access the file system using Firefox and Mozilla browsers. You cannot access the file system using Safari, Camino or Opera.

You could still use an ini file - but your javascript would not be able to access it directly... it might access it as javascript variables (as you mentioned) after it has been parsed by some preprocessor (like Ant for instance)... or it might be able to request the ini file from a web server (on a server somewhere in your organisation).

Maybe you could look around at how other web applications solve this kind of problem?

Cheers,
Jeff


[tt]Jeff's Page [!]@[/!] Code Couch
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Hi

Now, after your rewording, if the ini file is reachable through HTTP, maybe you would like to load the settings with AJAX, or just simply with an [tt]XMLHttpRequest[/tt]. With that you can download a file, then parse its content into variables.

Feherke.
 
Thanks Jeff and Feherke, thats given me more ideas. I will probably a Java applet that way it should work for all browsers.

Sal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top