Auto detect script location and domain