I have this site that I need to find the root folder / plus the actual folder its works out of.
My problem here is that during development i have the folder with in my l
You can map the url localhost/devbuild to localhost/mytestSiteA and use the first url to test your site locally. In your javascript you can always assume the devbuild folder then. That way you don't have to change anything else.
use relative paths so you don't need to get to the root folder
this doesn't work on sites with friendly urls with folders in the links
This is what worked for me after the switch
clause.
var root = location.protocol + '//' + location.host + rootFolder;
try to switch
switch (document.location.hostname)
{
case 'asite.com':
var rootFolder = '/devbuild/'; break;
case 'localhost' :
var rootFolder = '/mytestSiteA/'; break;
default : // set whatever you want
}
and then use
var root = document.location.hostname + rootFolder;