The relativeToAbsoluteURL() function
returns this needed information, given three arguments:
n docPathURL: The portion of the current document??™s relative pathname excluding the filename.
For example, if the file in question were to be found at images\austria.gif, the
docPathURL would be images/.
n siteRootURL: The file://URL of the current site root, as returned from the getSiteRoot()
function.
n relativeURL: The full relative pathname of the selected file (for example, images/
austria.gif).
The syntax for the function is as follows:
var absoluteURL =
dreamweaver.relativeToAbsoluteURL(docPathURL,siteRootURL,relativeURL);
Of the three arguments, only docPathURL is a little tricky. After you have the relativeURL, which can be
returned from the browseForFileURL() function, you need to examine the pathname and extract the
first part of the path leading up to the actual filename. To do so, use the JavaScript function lastIndexOf
to find the final ???/??? character and extract the previous substring. For example:
function docBase() {
var docURL = dreamweaver.getDocumentPath(???document???);
var index = docURL.lastIndexOf(???/??™);
if ( index == -1 ) { // If there is no additional path, return nothing
return ??????;
}
else {
return docURL.
Pages:
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946