• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

Textarea HTML Editor tool - URL path file://

The below code has something to do with it....the html editor that I am using, if you enter a http URL, no problem it works. But for some reason if I enter an internal URL like this: file://H:\folder name

I always get the result as: "file:///H:/folder name"  no matter what, it keeps adding an extra forward slash " / " in front of the file://. Is there anything wrong with the regular expression below? file:/// does not work, in outlook the file link works only with 2 slash file://H:/

try the demo here you'll see: http://www.openwebware.com/wysiwyg/demo.shtml
getDocumentPathOfUrl: function(url) {
		var path = null;
		
		// if local file system, convert local url into web url
		url = url.replace(/file:\/\//gi, "file://");
		url = url.replace(/\\/gi, "\/");
		var pos = url.lastIndexOf("/");
		if(pos != -1) {
			path = url.substring(0, pos + 1);
		}
		return path;
	},
	
	/**
	 * Get the documents url, convert local urls to web urls
	 * 
	 * @param {DOMElement} doc Document which is used to get the url
	 */
	getDocumentUrl: function(doc) {
		// if local file system, convert local url into web url
		var url = doc.URL;
		url = url.replace(/file:\/\//gi, "file://");
		url = url.replace(/\//gi, "/");
		return url;
	},

Open in new window

0
clubzone
Asked:
clubzone
  • 4
  • 2
1 Solution
 
amit_gCommented:
It is doing it correctly. In the local file URLs three slashes are needed. See the explanation.

http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx
0
 
clubzoneAuthor Commented:
The thing is I use this with my work Intranet server and 3 slashes does not work, people needs to link to Internal file server, therefore it has to be set to file://D:\folname\thisfile.xls

even if I enter 2 // instead of 3 manually, it automatically puts it back to 3 slashes, why is it doing this, and how to fix it for my behalf.
0
 
amit_gCommented:
What o/s and browser are you targeting (for the client not the web server)?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
clubzoneAuthor Commented:
windows XP Pro and IE6.0
0
 
clubzoneAuthor Commented:
well it seems to work now! the server has to match exactly. the lower and upper case made the difference. if I were to type in file:///h:/intranet instead of file:///H:/INTRANET it would not work, if you match it exactly it works, I did not know lower uppercase made the difference? strange.
0
 
clubzoneAuthor Commented:
Thanks for the link.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now