View Full Version : window.location= 'file:\\\c:\sharefolder'; is not working

01-26-2009, 08:49 AM
Hi Guys,

i try to open my local system share folder in browser using command
window.location= 'file:\\\c:\sharefolder';
where the folder sharefoler is in c;\ and it is shared

it is not opening in firefox and Google Chrome
:) can you help me pls :)

01-26-2009, 09:00 AM
Use forward slashes, browsers read virtual addresses.

window.location= "file:///c:/sharefolder";

01-26-2009, 10:04 AM
Can i ask why do you want to point some one to a local directory

01-27-2009, 07:27 AM
i can't user forward slashes. since ,the local folder can represent by using backslash.

and the main thing is

WHILE I PLACE THE URL file:\\\c:\sharefolder

direct in the address bar it is opening a local folder.
while i try this by using javascript it is not opening. so only i need to know
why it is not opening by using javascript?

01-27-2009, 11:31 AM
It is not opening using Javascript because you are not following the advice you were given after asking your question.

Use forward slashes.

02-02-2009, 06:29 AM
i tryed both but it is not opening. here is my code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="JavaScript">
function whatFile() {
window.location= 'file:///c:/sharefolder' ;

<input type="button" name="but" value="button" style="top:200px; left:200px;" onClick="javascript:whatFile()"/>

In this i tried both slashes forward and back slash. it is not opening

Philip M
02-02-2009, 08:34 AM
It works for me, so the trouble must be an incorrect path to the file.

<script language="JavaScript"> is deprecated. Use <script type = "text/javascript"> instead.

Remove the red:- onClick="javascript:whatFile()"/>

It is your responsibility to die() if necessary… - PHP Manual