Link to home
Start Free TrialLog in
Avatar of akoifman
akoifman

asked on

window.open() a local file?

Hi,

I use window.open('my.html', ) to load a page using HTTP.  But I can't load a page from my local HD.  If I use window.open('file://c:/my.html', ) or
window.open('c:/my.html', ) I get the JavaScript error. The error occurs in IE4 and Netscape, works fine in IE5.

What is the correct syntax to load a page of a local drive?

Thanks,

Alex
ASKER CERTIFIED SOLUTION
Avatar of kmartin7
kmartin7
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
Avatar of akoifman
akoifman

ASKER

Hi,

I back at this again.  I installed Netscape 4.6 I can load a local page.  I did configure it as file:///c|/my.html.

MS IE 5 works fine (do not know about 4.0) on Windows NT.
Cool =)
Hi,

I am sorry.  The above should have read:  I can NOT load a local HTTP file.  Can you help me?  I can not make Netscape read a local file (without going http server route).  

Thanks a lot,

Alex
Ah...

For clarification.  you said:

>I can NOT load a local HTTP file

A LOCAL http file?  Are you using Personal Web Server?  Or are you still having problems loading a local file from a page that was sent via http?

If it is the latter, it cannot be done in Netscape (due to security reasons) without a signed script.  The reasoning is that anyone coud read a file locally on your machine provided they know the directory path.  For instance, if I wrote a script to read the contents of file:///c|/Program%Files/Quicken/passwords/pwrd.pwd, then in essence, I could retrieve a lot of financial information about anyone who had quicken installed on their computer, taking the default installation path.

To what and for what do you plan on using this?  Is it going to be used on an intranet?  If it is for a controlled environment like an intranet, then either tell the corporation to use IE or create a signed script for Netscape.  Once the user grants permission to the script, it should run flawlessly.  Netscape has a "Signed Script Wizard" or something to that effect.  I downloaded it at one point, but never even looked at it.  My intention was to learn how to create signed scripts, but I have got around to learning how.

I will see if I can get more information on signed scripts...

Kurt

Hi,

We have a Hel-p system onstalled on a local HD.  Users do not have web server on their local machines.  Our system presents users with forms/tables containg some information.  Each form has a Help button.  The button is a JavaScript Open call.  I replaced the button with an Html img, but it does not allign well with other buttons on the form.  I had to go back to the Link.  This is the code fragment.

<FORM>
    <input type=button value=Help onClick="window.open('file://c:/3com/3_0/3500/System_Display.html', '3ComHelp' )">
</FORM>

Or I tried it with file:///c|/my.html.  The same problem.

Thanks,

Alex.


Okay...

Try this.  It worked on my Netscape 4.5:

<FORM>
<input type=button value=Help onClick="window.open('file:///c|/3com/3_0/3500/System_Display.html', '3ComHelp' )">
</FORM>

Kurt