Link to home
Start Free TrialLog in
Avatar of danielolorenz
danielolorenz

asked on

Cannot Read Text File to String Using JavaScript

I cannot read a text file using JavaScript.

My Code:
var eventLogFileStr = 'file://C:/MNTX/ET/ServerCore/ETUI/Web/javascripts/et/salient/97LabEventLog.txt';
            
            var txtFile = new XMLHttpRequest();
            txtFile.open("GET", eventLogFileStr, true);
            txtFile.onreadystatechange = function() {
              if (txtFile.readyState === 4) {  // Makes sure the document is ready to parse.
                if (txtFile.status === 200) {  // Makes sure it's found the file.
                  allText = txtFile.responseText;
                  lines = txtFile.responseText.split("\n"); // Will separate each line into an array
                }
              }
            }
            txtFile.send(null);

I am getting error: "Access Denied"

Thanks,

Dan
ASKER CERTIFIED SOLUTION
Avatar of gdpotter
gdpotter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danielolorenz
danielolorenz

ASKER

Excellent Comments