modified getUrlByIdx to include cookies