Forum Moderators: open

Message Too Old, No Replies

Relative Paths in External Javascript from different sub folders

Relative Paths in External Javascript from different sub folders

         

zlazla

5:10 pm on Aug 1, 2007 (gmt 0)

10+ Year Member



I have an external javascript file that contains a popup window function to display some static content. I want to call this function from different pages residing in different sub folders.

For example when I call the function from a root level page (localhost/MyVirtualDirectory/MyPage.aspx), the function has contain this:

var ow = window.open("Folder1/Pages/ppgDirections.aspx, "Directions", sFeatures);

But if I were to call the function from a different page (localhost/MyVirtualDirectory/Folder2/MyOtherPage.aspx), the function would probably have to contain this:

var ow = window.open("../Folder1/Pages/ppgDirections.aspx, "Directions", sFeatures);

How can I write the function so that it will work for both pages?

Thanks in advance.

Bernard Marx

9:52 pm on Aug 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make your path start from root:

"/MyVirtualDirectory/Folder1/Pages/ppgDirections.aspx