Solved

window.open() a local file?

Posted on 1999-01-28
7
6,622 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 11

Accepted Solution

by:
kmartin7 earned 100 total points
ID: 1280300
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
ID: 1280301
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
ID: 1280302
Cool =)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:akoifman
ID: 1280303
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
ID: 1280304
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
ID: 1280305
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
ID: 1280306
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

730 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