# Fuddling with paths

**URL:** <https://forum.kirupa.com/t/fuddling-with-paths/213895>\
**Category:** Uncategorized\
**Created:** [January 24, 2007, 2:56am UTC](https://forum.kirupa.com/t/fuddling-with-paths/213895 "2007-01-24T02:56:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icy\_Penguin](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@Icy\_Penguin](https://forum.kirupa.com/u/Icy_Penguin)\
**Post date:** [January 24, 2007, 2:56am UTC](https://forum.kirupa.com/t/fuddling-with-paths/213895/1 "2007-01-24T02:56:45Z")

</div>

Hi all.

Okay, for a site I’m developing for a client - WeldCo.ca - I just spent the last couple hours changing the paths that the xml for the images in the header loads at (since I cannot use absolute values - [www.weldco.ca won’t load http://weldco.ca](http://www.weldco.ca), and vise-versa) and since relative paths wouldn’t work since there are HTMs in different folders.

here’s the code i used (its crude, but it works):

```php

//define url (i.e., weldco.ca or www.weldco.ca
var thisURL = new String(this._url)
//used for thisDomainNameEtc
var endCap = ".ca/";
//yields either http://www.weldco.ca or http://weldco.ca
var thisDomainNameEtc = thisURL.slice(0, thisURL.indexOf(endCap)+endCap.length);
//something like index.htm or catalog/languages/english/index.php
var thisAfterPath = thisURL.slice(thisURL.indexOf(endCap)+endCap.length, thisURL.length);
//splits the string into an arrays aftr a slash
var slashes:Array = thisAfterPath.split("/");
//counts the length of the array (essentially the number of slashes in thisAfterPath) 
var slashTimes = slashes.length-1;
//defines new folder paths depending upon slashTimes
if (slashTimes == 0) {
    var prePath = ""    
}
if (slashTimes == 1) {
    var prePath = "../"    
}
if (slashTimes == 2) {
    var prePath = "../../"    
}
if (slashTimes == 3) {
    var prePath = "../../../"    
}
//loads the xml - e.g. http://www.weldco.ca/catalog/../media/images/images1.xml
Galeria.load(thisDomainNameEtc+prePath+"media/images"+slashTimes+".xml");

```

So I just used this.\_url to find the path and then used that to establish a relative path. Everything is working fine in Firefox, but everything is broken in IE. [Even the store isn’t updated](http://weldco.ca/catalog/) (the CSS didn’t update the h1 tags, etc.). Would anyone know if this is a problem in IE or with my code. Thanks.
