Link to home
Start Free TrialLog in
Avatar of smmsmm57
smmsmm57

asked on

want to load a local file off disk as an html page

when I run the code below I get a permission denied error. I have been trying to change/fix the syntax of the file url but apparently cannot get it right. I need this in a hurry and am trying to avoid spending a lot of time doing a Google for the answer....

function loadmain()
{
  window.location.href='file:///c:\inetpub\wwwroot\MdtMainFrm.htm'
}
 
setTimeout("loadmain()",1000);
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Is this from an Internet page or what type of page (i.e. local, intranet)?  What browser?

Browser security will prevent you from accessing local files if the page is an Internet page.  There are some browser (e.g. some versions of IE) that don't enforce this well but this will definitely be an issue for many browsers.  Local htm files or those that end with .hta have a lower security limit and could probably access the file.

Let me know if you have a question or need more info.

bol
Avatar of smmsmm57
smmsmm57

ASKER

It is a local file, in same folder as all of my asp and html pages....based on your comments, I will go look at Internet security settings?
are you saying that the syntax looks correct?
The syntax looks correct but I very seldom use the file: protocol and it seems that some browsers use a little different syntax (or work better with a different one).  What is the browser you are using?

Why use the file URL if the file is in the folder and on your local webserver?  Is the URL for the main page http: or file: ?

bol
Another way to write it which you can try is ...

window.location.href='file:///c:/inetpub/wwwroot/MdtMainFrm.htm'

bol
Let me explain what I am trying to accomplish. I have an html/asp app that runs on a laptop that brings up the web app as part of its startup.

I am trying to let the IIS.exe and other aspects of the OS get started so I do not want the browser to have to bother the IIS exe and load the html file as html w/o having the iis have to deal with it. I hope I am explaining this well enough because I kinda inherited this app and am a C++ person by experience and this html stuff is new to me.....

Anyway, I want to be able to load the file in the browser as straight html such that it only gets interpreted by the browser.....it is Internet expl version 7
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
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
netmunky - http:#20016152.  I'm glad it worked for you.

bol
I'm glad I could help.  Thanks for the grade, the points and the fun question.

bol