Solved

window.open() a local file?

Posted on 1999-01-28
7
6,164 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:akoifman
  • 4
  • 3
7 Comments
 
LVL 11

Accepted Solution

by:
kmartin7 earned 100 total points
Comment Utility
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
 

Author Comment

by:akoifman
Comment Utility
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
 
LVL 11

Expert Comment

by:kmartin7
Comment Utility
Cool =)
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:akoifman
Comment Utility
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
 
LVL 11

Expert Comment

by:kmartin7
Comment Utility
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
 

Author Comment

by:akoifman
Comment Utility
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
 
LVL 11

Expert Comment

by:kmartin7
Comment Utility
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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 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

17 Experts available now in Live!

Get 1:1 Help Now