View Full Version : how to get the path of a document - need quick responce
canadianjameson
10-22-2004, 03:57 PM
if your code is running from (PATH HERE)/javacode.js
if there a way in the code (thats running from javacode.js) to find out the (PATH HERE) part?
a buddy needs it quickly :)
he's using VB.net but he figures if he knows how to do it in JS it'll give him a start
liorean
10-22-2004, 04:11 PM
Well, it's not quite easy. The document.domain property contains the domain for the HTML document. The document.URL property contains the full url to the HTML document. The document.location property contains a breakdown of the HTML document URL. The src attribute of the script element will contain the URL to the script. If this property happens to be relative, a browser may return it either as a full URL or as a relative URL. If it's root relative, you can just add the document.domain property in front of it. If it is document relative, you need to replace the file part of the HTML document location with the script address. And of course, if it's an absolute URL, you need do nothing. All of these require you to read the src attribute of the script element in question.
canadianjameson
10-22-2004, 04:24 PM
i think it helped him, he seems to have fixed it
Thanks liorean
canadianjameson
10-22-2004, 04:38 PM
he used this:
StreamReader(System.AppDomain.CurrentDomain.BaseDirectory & "FwConfig.xml")
liorean
10-22-2004, 04:46 PM
Hmm. Are we talking about the Windows Scripting Host here? Because I don't recognise those host environment identifiers.
Oh. You said he was using VB.net, that explains it...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.