cmattoon Posted May 14, 2011 Share Posted May 14, 2011 Let me preface this with "I know next to nothing about JavaScript, and usually can't even get a simple, pre-written JS function to run properly". What I'm trying to do is develop a series of HTML templates that provide pseudo-dynamic data on a local machine. For example, you could write a text file, name it "config.txt" and place it in the same directory as this template, zip it, and email it to me, and i open up the HTML file as a local file, and can view your content. Sample "config.txt" BACKCOLOR FFFFFF; TXTCOLOR 000000; :1: TXT "Hello World! This is a page of text."; IMG picture.png; CLICK next [2]; :2: TXT "This is page 2."; IMG picture2.png; CLICK back [1]; CLICK next [3]; I guess it is like Powerpoint meets batch files or QBASIC. I know it's a lot of work for something really silly, and if there's an easier way to do it, by all means - let me know. JavaScript is just the only client-side script I know of, and I'm even worse at Flash (IIRC, it has this capability with XML files). The question is, can you (how do you...) import this file with JavaScript, parse it, and somehow make the browser know which content to load. My hopes are to do something like PHP does: <img src="<?=$image;?>"> <a href="<?=$url;?>"><?=$linkText;?></a> .... Any thoughts? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/236433-read-config-file-on-local-machine/ Share on other sites More sharing options...
.josh Posted May 16, 2011 Share Posted May 16, 2011 As a security measure, you cannot do this with Javascript. The only thing on your machine Javascript is allowed to read are cookies from the browser's cookie file, based on the domain of the requested page. In order to do something like this, you will need to write a browser plugin or ActiveX control to act as a proxy between the file and javascript - something the user will have to specifically install or allow to run in the browser. Quote Link to comment https://forums.phpfreaks.com/topic/236433-read-config-file-on-local-machine/#findComment-1215897 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.