Disable Active-X Warning message, or alternate way to open a text file on local computer from webpage

Posted on 2004-11-21
Last Modified: 2008-02-01
I developed a simple client-side application that runs through a web browser such as IE, and can connect to and modify a local access database while the user is interacting with html based pages.  One requirement is that I need to open a local text file at one point, and read some data from that textfile.  I've been using this method:

var firstvalue, secondvalue;
fso = new ActiveXObject("Scripting.FileSystemObject");            
f = fso.OpenTextFile(LOGFILE, 1);      
secondvalue =  f.ReadLine();
secondvalue =  f.ReadLine();
So basically I'm using an ActiveX object to read the file.  The problem with this is that every time I use this activex object, a warning window pops up asking if it is ok to allow this interaction.  "Allowing active content such as script and ActiveX controls can be useful, but active content might also harm your computer.  Are you sure you want to let this file run active content?"  This is no good, because the user will get very annoyed having to always say "yes" each time they use the application.  I don't know of another way to read data from a local textfile either, or I would use it.

Is there a way to access a text file on a local computer through a webpage (client side, no server) without warning messages poping up?  I know there are a lot of security settings in Internet Explorer involving ActiveX which I can disable, but even after disabling all of them this particular message still shows up.  On top of that, I don't necessarily have control over the computers this application will be installed onto (so I won't be able to go into their IE settings anyway), and other programs like Norton will also try and stop this script.  The funny thing is, I'm able to read and write (add records, remove records, etc) to a database to my hearts content without seeing any warning messages whatsoever, or even getting permission from the user, but when I want to read (not write) from a simple text file, all these red flags start going off.

Maybe I can somehow register the active-x control on a local computer so that the warnings go away?  Or is there a different way to read a local text file from an html page?

Thanks in advance
Question by:nexisvi
    LVL 19

    Accepted Solution

    It's a security feature. You cannot disable it. You're accessing info on the USER'S computer. They should know that.

    Why not just write an actual app that they install and run locally that connects to the web? Then you'd have permission on their system (it would be a local app), and they wouldn't get security prompts.

    Author Comment

    I don't understand why I'm able to access a database file on their computer, make modifications to it, and even delete records, and it doesn't give a single prompt or ask for permission... yet to just read from a file ... anyway

    The main issue is that I didn't write this app, and I don't have access to the original source.  What they wanted was a quick way to do some database modifications through web based forms (viewed internally in the application), without having to modify the original app.  Currently the app has the ability to launch webpages internally (through an embeded IE browser it seems using Visual Basic), it's easy to code some simple html forms, and link them to an access database.  The problem is that I need to read a "log" file to determine which record is currently locked.  That's how I know which record the user is working on inside the application.  There is no way for the app to communicate this to the webpage, unfortunately.  It's out of my control, but the way the app launches internal webpages is by reading another file, which was created ahead of time, that tells it which html files to launch.  That eliminates me being able to do something like "myforms.html?recordid=5", because you don't know what record they will be working on ahead of time.

    There must be some sort of trick to getting the info I need from the log file?  I was reading about using innerText, outerText, etc.  But it seems like I'd need some tags in the file I want to read from, and this log file does not have tags.
    LVL 53

    Assisted Solution

    The web page is not modifying or insert into the database; the vb app is, using a privileged mode however for the read you are doing it from a web page with activeX and that does not have a privileged mode.  The read either has to be done in the VB app or your user's have to live with warnings.  The warnings are necessary because there must be assurance that information on the Hard drive cannot be accessed by a web page with the user knowing what is going on.  Otherwise it would be a huge security hole that would quickly be exploited by hackers to steal information from client computers.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: CSS Specialist

    We don’t have to sell you on the idea of becoming a developer. If you’re you here, you already know it’s one of the most lucrative (and fastest growing) career tracks out there. It’s CSS that allows you to set yourself apart from other web and mobile developers.

    Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now