Welcome to WebmasterWorld Guest from 18.232.53.231

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

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

New User

10+ Year Member

joined:Aug 1, 2007
posts:1
votes: 0


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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
posts:2047
votes: 0


Make your path start from root:

"/MyVirtualDirectory/Folder1/Pages/ppgDirections.aspx

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members