473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

URL to link to a file

7
I have some JS code that reads URLs file links from a database and creates link the the files on a web page. It works fine in IE 6 but now I want it to work in Firefox. The URLs I need to handle are:
file:\\Server\Share\Directory\File.ext
file:\\\\Server\Share\Directory\File.ext
file://Server/Share/Directory/File.ext

I have figured out if I use 5 backslashes it will work in both browsers. I am having problems replacing the slashes. I think they might be getting interpretded as escape characters. Does anybody have some code to make these links work in both browsers?

Thanks,
Paul
Jan 3 '08 #1
3 1555
acoder
16,027 Expert Mod 8TB
Can you show the code that you're having problems with.
Jan 4 '08 #2
hd181a
7
Can you show the code that you're having problems with.
Here is the code.
Expand|Select|Wrap|Line Numbers
  1.     function fnNewWindow<%=lintGadgetID%>(lstrurl,ablnWindowStatus)
  2.     {
  3.         var lstrPageName;   //variable to hold Page name.
  4.         var lstrnewWind;      //variable to hold Window status.
  5.         lstrPageName = lstrurl;    
  6.  
  7.         if(lstrPageName.substring(0,3).toUpperCase()=="WWW")
  8.             lstrPageName = "http://"+lstrPageName;
  9.  
  10.         if    ((lstrPageName.substring(0,4).toUpperCase()!="HTTP")&&(lstrPageName.substring(0,4).toUpperCase()!="FILE"))
  11.             lstrPageName = "file:"+lstrPageName;
  12.         else if(lstrPageName.substring(0,4).toUpperCase()!="FILE")
  13.             lstrPageName = lstrPageName
  14.         if (ablnWindowStatus == 0)
  15.             document.location.href=lstrPageName;            
  16.         else
  17.             lstrWindowStatus = window.open(lstrPageName,"New_Win","width=640,height=480,left=120,top=30,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,location=yes,menubar=yes,directories=yes");
  18.  
  19.     }
  20.  
  21.  
Jan 4 '08 #3
acoder
16,027 Expert Mod 8TB
The URL should use forward slashes - see this Mozillazine link.

One other thing: document.location.href should be window.location.href.
Jan 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: j erickson | last post by:
with the following xsl and xml file, the display of the gif file with the <image/url> tag works. However, the gif file in the <description> tag using the name attribute "src" won't make the correct...
2
by: JenHu | last post by:
hi, I have a datagrid in my asp.net application, I am using vb.net language. I want to have my last column as a link column, link to text file. The link path is "c:\Temp\" & F_File_Name, which...
6
by: Ozz | last post by:
Hi there, I have a link on my web page. When clicked, opens up a pdf file that is stored on my server. Every file is specific to a user's user name and I don't want users to see each other's...
0
by: kain razial | last post by:
ANYOTHER NEEDS ALSO CONTACT ME.I WILL HELP YOU TO GET THAT TEKLA XSTEEL V 12 DOWNLOAD LINK. http://www.sendspace.com/file/zem32r
0
by: kain razial | last post by:
ANYOTHER NEEDS ALSO CONTACT ME.I WILL HELP YOU TO GET THAT TEKLA XSTEEL V 12 DOWNLOAD LINK. http://www.sendspace.com/file/zem32r
1
yabansu
by: yabansu | last post by:
Hi all, I implemented a basic client application. It communicates with server and works properly. Building processes succeed just by giving the following warning: LINK : D:\DOC\Visual Studio...
26
by: Nospam | last post by:
I am trying to open a link in a new template window : <a onclick="windowopen('example.html','example');return false;" href="http://www.example.com" target="_blank"example link</a> such that...
8
by: Bern McCarty | last post by:
We have a large mixed dll that I can never seem to get to link incrementally. Below is the console output. For simplicity I've eliminated some stuff that we normally do when we really link this...
11
by: mosscliffe | last post by:
I am trying to create a link to a file, which I can then use in an HTML page. The system is Linux on a hosted web service, running python 2.3. Other than that I have no knowledge of the system....
0
ADezii
by: ADezii | last post by:
Rather than using CurrentProject.Connection or entering your own Connection information, ADO supports storing Connection information in an external file called a Data Link File (which normally has a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.