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
akoifmanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
kmartin7Connect With a Mentor Commented:
The correct syntaxz is:

file:///c|/my.html

But, it will not work in Netscape if the page is loaded via HTTP. Netscape does not allow the use of the file protocol when sent over an FTP or HTTP protocol because this was considered a  *bug* with an earlier version of Netscape. This bug allowed a specially designed web page to read text or HTML files from the user's computer and send their contents to an arbitrary host, even if the user is behind firewall. The bug uses Javascript and the file name and location must be known.

For more info, go to:

http://www.geek-girl.com/bugtraq/1998_3/0763.html

Kurt
0
 
akoifmanAuthor Commented:
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.
0
 
kmartin7Commented:
Cool =)
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
akoifmanAuthor Commented:
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
0
 
kmartin7Commented:
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

0
 
akoifmanAuthor Commented:
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.


0
 
kmartin7Commented:
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.